diff options
author | ctguil@chromium.org <ctguil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-11 19:50:12 +0000 |
---|---|---|
committer | ctguil@chromium.org <ctguil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-11 19:50:12 +0000 |
commit | ca85b1daf4546fd8f0415f0803038741a656a3fb (patch) | |
tree | 3aa724bcf2a9d7e9f1e8bc47ffd07c2ca7666f64 /skia | |
parent | d964ab3dc471d1be3fb2d20709e4117dbe6aa9e0 (diff) | |
download | chromium_src-ca85b1daf4546fd8f0415f0803038741a656a3fb.zip chromium_src-ca85b1daf4546fd8f0415f0803038741a656a3fb.tar.gz chromium_src-ca85b1daf4546fd8f0415f0803038741a656a3fb.tar.bz2 |
Assert on BeginPlatformPaint/EndPlatformPaint mismatch.
BUG=80616
TEST=none
Review URL: http://codereview.chromium.org/6949012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85019 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia')
-rw-r--r-- | skia/ext/bitmap_platform_device_win.cc | 9 | ||||
-rw-r--r-- | skia/ext/bitmap_platform_device_win.h | 13 |
2 files changed, 18 insertions, 4 deletions
diff --git a/skia/ext/bitmap_platform_device_win.cc b/skia/ext/bitmap_platform_device_win.cc index 5c0bd61..5678b9b 100644 --- a/skia/ext/bitmap_platform_device_win.cc +++ b/skia/ext/bitmap_platform_device_win.cc @@ -177,6 +177,7 @@ BitmapPlatformDevice::BitmapPlatformDevice( : PlatformDevice(bitmap), data_(data) { // The data object is already ref'ed for us by create(). + SkDEBUGCODE(begin_paint_count_ = 0); } // The copy constructor just adds another reference to the underlying data. @@ -188,9 +189,11 @@ BitmapPlatformDevice::BitmapPlatformDevice( const_cast<BitmapPlatformDevice&>(other).accessBitmap(true)), data_(other.data_) { data_->ref(); + SkDEBUGCODE(begin_paint_count_ = 0); } BitmapPlatformDevice::~BitmapPlatformDevice() { + SkASSERT(begin_paint_count_ == 0); data_->unref(); } @@ -202,9 +205,15 @@ BitmapPlatformDevice& BitmapPlatformDevice::operator=( } HDC BitmapPlatformDevice::BeginPlatformPaint() { + SkDEBUGCODE(begin_paint_count_++); return data_->GetBitmapDC(); } +void BitmapPlatformDevice::EndPlatformPaint() { + SkASSERT(begin_paint_count_--); + PlatformDevice::EndPlatformPaint(); +} + void BitmapPlatformDevice::setMatrixClip(const SkMatrix& transform, const SkRegion& region, const SkClipStack&) { diff --git a/skia/ext/bitmap_platform_device_win.h b/skia/ext/bitmap_platform_device_win.h index 485c532..7f901f5 100644 --- a/skia/ext/bitmap_platform_device_win.h +++ b/skia/ext/bitmap_platform_device_win.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef SKIA_BITMAP_PLATFORM_DEVICE_WIN_H_ -#define SKIA_BITMAP_PLATFORM_DEVICE_WIN_H_ +#ifndef SKIA_EXT_BITMAP_PLATFORM_DEVICE_WIN_H_ +#define SKIA_EXT_BITMAP_PLATFORM_DEVICE_WIN_H_ #pragma once #include "skia/ext/platform_device_win.h" @@ -12,7 +12,7 @@ namespace skia { class BitmapPlatformDeviceFactory : public SkDeviceFactory { public: - virtual SkDevice* newDevice(SkCanvas* ignored, SkBitmap::Config config, + virtual SkDevice* newDevice(SkCanvas* ignored, SkBitmap::Config config, int width, int height, bool isOpaque, bool isForLayer); }; @@ -72,6 +72,7 @@ class SK_API BitmapPlatformDevice : public PlatformDevice { // Retrieves the bitmap DC, which is the memory DC for our bitmap data. The // bitmap DC is lazy created. virtual PlatformSurface BeginPlatformPaint(); + virtual void EndPlatformPaint(); // Loads the given transform and clipping region into the HDC. This is // overridden from SkDevice. @@ -108,9 +109,13 @@ class SK_API BitmapPlatformDevice : public PlatformDevice { // Data associated with this device, guaranteed non-null. We hold a reference // to this object. BitmapPlatformDeviceData* data_; + +#ifdef SK_DEBUG + int begin_paint_count_; +#endif }; } // namespace skia -#endif // SKIA_BITMAP_PLATFORM_DEVICE_WIN_H_ +#endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_WIN_H_ |