TestDrawTargetBase.h (1153B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #pragma once 8 9 #include "2D.h" 10 #include "TestBase.h" 11 12 #define DT_WIDTH 500 13 #define DT_HEIGHT 500 14 15 /* This general DrawTarget test class can be reimplemented by a child class 16 * with optional additional drawtarget-specific tests. And is intended to run 17 * on a 500x500 32 BPP drawtarget. 18 */ 19 class TestDrawTargetBase : public TestBase { 20 public: 21 void Initialized(); 22 void FillCompletely(); 23 void FillRect(); 24 25 protected: 26 TestDrawTargetBase(); 27 28 void RefreshSnapshot(); 29 30 void VerifyAllPixels(const mozilla::gfx::DeviceColor& aColor); 31 void VerifyPixel(const mozilla::gfx::IntPoint& aPoint, 32 mozilla::gfx::DeviceColor& aColor); 33 34 uint32_t RGBAPixelFromColor(const mozilla::gfx::DeviceColor& aColor); 35 36 RefPtr<mozilla::gfx::DrawTarget> mDT; 37 RefPtr<mozilla::gfx::DataSourceSurface> mDataSnapshot; 38 };