Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(399)

Unified Diff: skia/ext/bitmap_platform_device_mac_unittest.cc

Issue 1963713002: Replace setMatrixClip() with BeginPlatformPaint() logic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: compensate for any outstanding saveLayer() calls Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « skia/ext/bitmap_platform_device_mac.cc ('k') | skia/ext/bitmap_platform_device_skia.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ext/bitmap_platform_device_mac_unittest.cc
diff --git a/skia/ext/bitmap_platform_device_mac_unittest.cc b/skia/ext/bitmap_platform_device_mac_unittest.cc
index be70df3243f52cdfe28a09be3c2656536746808f..e6f3c759334912b7d3de17e94726e85d213aa225 100644
--- a/skia/ext/bitmap_platform_device_mac_unittest.cc
+++ b/skia/ext/bitmap_platform_device_mac_unittest.cc
@@ -6,11 +6,12 @@
#include <memory>
+#include "skia/ext/platform_canvas.h"
#include "skia/ext/skia_utils_mac.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkClipStack.h"
#include "third_party/skia/include/core/SkMatrix.h"
-#include "third_party/skia/include/core/SkRegion.h"
+#include "third_party/skia/include/core/SkRect.h"
namespace skia {
@@ -24,21 +25,19 @@ class BitmapPlatformDeviceMacTest : public testing::Test {
NULL, kWidth, kHeight, /*is_opaque=*/true));
}
- std::unique_ptr<BitmapPlatformDevice> bitmap_;
+ sk_sp<BitmapPlatformDevice> bitmap_;
};
TEST_F(BitmapPlatformDeviceMacTest, ClipRectTransformWithTranslate) {
SkMatrix transform;
transform.setTranslate(50, 140);
- SkClipStack ignore;
- SkRegion clip_region;
- SkIRect rect;
- rect.set(0, 0, kWidth, kHeight);
- clip_region.setRect(rect);
- bitmap_->setMatrixClip(transform, clip_region, ignore);
+ sk_sp<SkCanvas> canvas(skia::CreateCanvas(bitmap_, CRASH_ON_FAILURE));
+ canvas->setMatrix(transform);
+
+ ScopedPlatformPaint p(canvas.get());
+ CGContextRef context = p.GetPlatformSurface();
- CGContextRef context = bitmap_->GetBitmapContext();
SkRect clip_rect = skia::CGRectToSkRect(CGContextGetClipBoundingBox(context));
transform.mapRect(&clip_rect);
EXPECT_EQ(0, clip_rect.fLeft);
@@ -51,14 +50,12 @@ TEST_F(BitmapPlatformDeviceMacTest, ClipRectTransformWithScale) {
SkMatrix transform;
transform.setScale(0.5, 0.5);
- SkClipStack unused;
- SkRegion clip_region;
- SkIRect rect;
- rect.set(0, 0, kWidth, kHeight);
- clip_region.setRect(rect);
- bitmap_->setMatrixClip(transform, clip_region, unused);
+ sk_sp<SkCanvas> canvas(skia::CreateCanvas(bitmap_, CRASH_ON_FAILURE));
+ canvas->setMatrix(transform);
+
+ ScopedPlatformPaint p(canvas.get());
+ CGContextRef context = p.GetPlatformSurface();
- CGContextRef context = bitmap_->GetBitmapContext();
SkRect clip_rect = skia::CGRectToSkRect(CGContextGetClipBoundingBox(context));
transform.mapRect(&clip_rect);
EXPECT_EQ(0, clip_rect.fLeft);
« no previous file with comments | « skia/ext/bitmap_platform_device_mac.cc ('k') | skia/ext/bitmap_platform_device_skia.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698