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

Side by Side Diff: skia/ext/platform_canvas_unittest.cc

Issue 2294813002: Start hiding deprecated skia/ext/ functions (Closed)
Patch Set: re-add another SK_API Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « skia/ext/platform_canvas.cc ('k') | skia/ext/platform_device.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // TODO(awalker): clean up the const/non-const reference handling in this test 5 // TODO(awalker): clean up the const/non-const reference handling in this test
6 6
7 #include "skia/ext/platform_canvas.h" 7 #include "skia/ext/platform_canvas.h"
8 8
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 // Return true if canvas has something that passes for a rounded-corner 83 // Return true if canvas has something that passes for a rounded-corner
84 // rectangle. Basically, we're just checking to make sure that the pixels in the 84 // rectangle. Basically, we're just checking to make sure that the pixels in the
85 // middle are of rect_color and pixels in the corners are of canvas_color. 85 // middle are of rect_color and pixels in the corners are of canvas_color.
86 bool VerifyRoundedRect(const SkCanvas& canvas, 86 bool VerifyRoundedRect(const SkCanvas& canvas,
87 uint32_t canvas_color, 87 uint32_t canvas_color,
88 uint32_t rect_color, 88 uint32_t rect_color,
89 int x, 89 int x,
90 int y, 90 int y,
91 int w, 91 int w,
92 int h) { 92 int h) {
93 SkBaseDevice* device = skia::GetTopDevice(canvas); 93 SkBaseDevice* device = canvas.getTopDevice(true);
94 const SkBitmap& bitmap = device->accessBitmap(false); 94 const SkBitmap& bitmap = device->accessBitmap(false);
95 SkAutoLockPixels lock(bitmap); 95 SkAutoLockPixels lock(bitmap);
96 96
97 // Check corner points first. They should be of canvas_color. 97 // Check corner points first. They should be of canvas_color.
98 if (!IsOfColor(bitmap, x, y, canvas_color)) return false; 98 if (!IsOfColor(bitmap, x, y, canvas_color)) return false;
99 if (!IsOfColor(bitmap, x + w, y, canvas_color)) return false; 99 if (!IsOfColor(bitmap, x + w, y, canvas_color)) return false;
100 if (!IsOfColor(bitmap, x, y + h, canvas_color)) return false; 100 if (!IsOfColor(bitmap, x, y + h, canvas_color)) return false;
101 if (!IsOfColor(bitmap, x + w, y, canvas_color)) return false; 101 if (!IsOfColor(bitmap, x + w, y, canvas_color)) return false;
102 102
103 // Check middle points. They should be of rect_color. 103 // Check middle points. They should be of rect_color.
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 } 407 }
408 canvas->restore(); 408 canvas->restore();
409 EXPECT_TRUE(VerifyRoundedRect(*canvas, SK_ColorWHITE, SK_ColorBLACK, 409 EXPECT_TRUE(VerifyRoundedRect(*canvas, SK_ColorWHITE, SK_ColorBLACK,
410 kInnerX + 1, kInnerY + 1, kInnerW, kInnerH)); 410 kInnerX + 1, kInnerY + 1, kInnerW, kInnerH));
411 #endif 411 #endif
412 } 412 }
413 413
414 #endif // #if !defined(USE_AURA) 414 #endif // #if !defined(USE_AURA)
415 415
416 } // namespace skia 416 } // namespace skia
OLDNEW
« no previous file with comments | « skia/ext/platform_canvas.cc ('k') | skia/ext/platform_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698