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

Side by Side Diff: ui/gfx/canvas_skia.cc

Issue 8405002: ui/gfx: Convert Canvas::FillRectInt() to use gfx::Rect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "ui/gfx/canvas_skia.h" 5 #include "ui/gfx/canvas_skia.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 } 115 }
116 116
117 void CanvasSkia::Translate(const gfx::Point& point) { 117 void CanvasSkia::Translate(const gfx::Point& point) {
118 canvas_->translate(SkIntToScalar(point.x()), SkIntToScalar(point.y())); 118 canvas_->translate(SkIntToScalar(point.x()), SkIntToScalar(point.y()));
119 } 119 }
120 120
121 void CanvasSkia::Scale(int x_scale, int y_scale) { 121 void CanvasSkia::Scale(int x_scale, int y_scale) {
122 canvas_->scale(SkIntToScalar(x_scale), SkIntToScalar(y_scale)); 122 canvas_->scale(SkIntToScalar(x_scale), SkIntToScalar(y_scale));
123 } 123 }
124 124
125 void CanvasSkia::FillRectInt(const SkColor& color, int x, int y, int w, int h) { 125 void CanvasSkia::FillRect(const SkColor& color, const gfx::Rect& rect) {
126 FillRectInt(color, x, y, w, h, SkXfermode::kSrcOver_Mode); 126 FillRect(color, rect, SkXfermode::kSrcOver_Mode);
127 } 127 }
128 128
129 void CanvasSkia::FillRectInt(const SkColor& color, 129 void CanvasSkia::FillRect(const SkColor& color,
130 int x, int y, int w, int h, 130 const gfx::Rect& rect,
131 SkXfermode::Mode mode) { 131 SkXfermode::Mode mode) {
132 SkPaint paint; 132 SkPaint paint;
133 paint.setColor(color); 133 paint.setColor(color);
134 paint.setStyle(SkPaint::kFill_Style); 134 paint.setStyle(SkPaint::kFill_Style);
135 paint.setXfermodeMode(mode); 135 paint.setXfermodeMode(mode);
136 DrawRectInt(x, y, w, h, paint); 136 DrawRectInt(rect.x(), rect.y(), rect.width(), rect.height(), paint);
137 } 137 }
138 138
139 void CanvasSkia::FillRectInt(const gfx::Brush* brush, 139 void CanvasSkia::FillRect(const gfx::Brush* brush, const gfx::Rect& rect) {
140 int x, int y, int w, int h) {
141 const SkiaShader* shader = static_cast<const SkiaShader*>(brush); 140 const SkiaShader* shader = static_cast<const SkiaShader*>(brush);
142 SkPaint paint; 141 SkPaint paint;
143 paint.setShader(shader->shader()); 142 paint.setShader(shader->shader());
144 // TODO(beng): set shader transform to match canvas transform. 143 // TODO(beng): set shader transform to match canvas transform.
145 DrawRectInt(x, y, w, h, paint); 144 DrawRectInt(rect.x(), rect.y(), rect.width(), rect.height(), paint);
146 } 145 }
147 146
148 void CanvasSkia::DrawRectInt(const SkColor& color, int x, int y, int w, int h) { 147 void CanvasSkia::DrawRectInt(const SkColor& color, int x, int y, int w, int h) {
149 DrawRectInt(color, x, y, w, h, SkXfermode::kSrcOver_Mode); 148 DrawRectInt(color, x, y, w, h, SkXfermode::kSrcOver_Mode);
150 } 149 }
151 150
152 void CanvasSkia::DrawRectInt(const SkColor& color, 151 void CanvasSkia::DrawRectInt(const SkColor& color,
153 int x, int y, int w, int h, 152 int x, int y, int w, int h,
154 SkXfermode::Mode mode) { 153 SkXfermode::Mode mode) {
155 SkPaint paint; 154 SkPaint paint;
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 412
414 CanvasPaint* CanvasPaint::CreateCanvasPaint(gfx::NativeView view) { 413 CanvasPaint* CanvasPaint::CreateCanvasPaint(gfx::NativeView view) {
415 #if defined(OS_WIN) && !defined(USE_AURA) 414 #if defined(OS_WIN) && !defined(USE_AURA)
416 return new CanvasPaintWin(view); 415 return new CanvasPaintWin(view);
417 #else 416 #else
418 return NULL; 417 return NULL;
419 #endif 418 #endif
420 } 419 }
421 420
422 } // namespace gfx 421 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698