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

Side by Side Diff: base/gfx/platform_canvas_unittest.cc

Issue 5644: Add platform_canvas_unittest.cc (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include <windows.h> 10 #include <windows.h>
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 inner_rc.bottom = y + h; 71 inner_rc.bottom = y + h;
72 FillRect(dc, &inner_rc, reinterpret_cast<HBRUSH>(GetStockObject(BLACK_BRUSH))) ; 72 FillRect(dc, &inner_rc, reinterpret_cast<HBRUSH>(GetStockObject(BLACK_BRUSH))) ;
73 73
74 canvas.endPlatformPaint(); 74 canvas.endPlatformPaint();
75 } 75 }
76 #elif defined(OS_MACOSX) 76 #elif defined(OS_MACOSX)
77 void DrawNativeRect(PlatformCanvas& canvas, int x, int y, int w, int h) { 77 void DrawNativeRect(PlatformCanvas& canvas, int x, int y, int w, int h) {
78 CGContextRef context = canvas.beginPlatformPaint(); 78 CGContextRef context = canvas.beginPlatformPaint();
79 79
80 CGRect inner_rc = CGRectMake(x, y, w, h); 80 CGRect inner_rc = CGRectMake(x, y, w, h);
81 CGFloat black[] = { 0.0, 0.0, 0.0, 1.0 }; // RGBA opaque black 81 // RGBA opaque black
82 CGContextSetFillColor(context, black); 82 CGColorRef black = CGColorCreateGenericRGB(0.0, 0.0, 0.0, 1.0);
83 CGContextSetFillColorWithColor(context, black);
84 CGColorRelease(black);
83 CGContextFillRect(context, inner_rc); 85 CGContextFillRect(context, inner_rc);
84 86
85 canvas.endPlatformPaint(); 87 canvas.endPlatformPaint();
86 } 88 }
87 #else 89 #else
88 void DrawNativeRect(PlatformCanvas& canvas, int x, int y, int w, int h) { 90 void DrawNativeRect(PlatformCanvas& canvas, int x, int y, int w, int h) {
89 NOTIMPLEMENTED(); 91 NOTIMPLEMENTED();
90 } 92 }
91 #endif 93 #endif
92 94
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 AddClip(canvas, kInnerX, kInnerY, kInnerW, kInnerH); 287 AddClip(canvas, kInnerX, kInnerY, kInnerW, kInnerH);
286 DrawNativeRect(canvas, 0, 0, 100, 100); 288 DrawNativeRect(canvas, 0, 0, 100, 100);
287 } 289 }
288 canvas.restore(); 290 canvas.restore();
289 EXPECT_TRUE(VerifyBlackSquare(canvas, kInnerX + 2, kInnerY + 2, 291 EXPECT_TRUE(VerifyBlackSquare(canvas, kInnerX + 2, kInnerY + 2,
290 kInnerW, kInnerH)); 292 kInnerW, kInnerH));
291 } 293 }
292 294
293 } // namespace 295 } // namespace
294 296
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698