OLD | NEW |
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 #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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 } | 131 } |
132 | 132 |
133 void CanvasSkia::Translate(const gfx::Point& point) { | 133 void CanvasSkia::Translate(const gfx::Point& point) { |
134 canvas_->translate(SkIntToScalar(point.x()), SkIntToScalar(point.y())); | 134 canvas_->translate(SkIntToScalar(point.x()), SkIntToScalar(point.y())); |
135 } | 135 } |
136 | 136 |
137 void CanvasSkia::Scale(int x_scale, int y_scale) { | 137 void CanvasSkia::Scale(int x_scale, int y_scale) { |
138 canvas_->scale(SkIntToScalar(x_scale), SkIntToScalar(y_scale)); | 138 canvas_->scale(SkIntToScalar(x_scale), SkIntToScalar(y_scale)); |
139 } | 139 } |
140 | 140 |
141 void CanvasSkia::FillRect(const SkColor& color, const gfx::Rect& rect) { | 141 void CanvasSkia::FillRect(const gfx::Rect& rect, const SkColor& color) { |
142 FillRect(color, rect, SkXfermode::kSrcOver_Mode); | 142 FillRect(rect, color, SkXfermode::kSrcOver_Mode); |
143 } | 143 } |
144 | 144 |
145 void CanvasSkia::FillRect(const SkColor& color, | 145 void CanvasSkia::FillRect(const gfx::Rect& rect, |
146 const gfx::Rect& rect, | 146 const SkColor& color, |
147 SkXfermode::Mode mode) { | 147 SkXfermode::Mode mode) { |
148 SkPaint paint; | 148 SkPaint paint; |
149 paint.setColor(color); | 149 paint.setColor(color); |
150 paint.setStyle(SkPaint::kFill_Style); | 150 paint.setStyle(SkPaint::kFill_Style); |
151 paint.setXfermodeMode(mode); | 151 paint.setXfermodeMode(mode); |
152 DrawRect(rect, paint); | 152 DrawRect(rect, paint); |
153 } | 153 } |
154 | 154 |
155 void CanvasSkia::FillRect(const gfx::Brush* brush, const gfx::Rect& rect) { | 155 void CanvasSkia::FillRect(const gfx::Rect& rect, const gfx::Brush* brush) { |
156 const SkiaShader* shader = static_cast<const SkiaShader*>(brush); | 156 const SkiaShader* shader = static_cast<const SkiaShader*>(brush); |
157 SkPaint paint; | 157 SkPaint paint; |
158 paint.setShader(shader->shader()); | 158 paint.setShader(shader->shader()); |
159 // TODO(beng): set shader transform to match canvas transform. | 159 // TODO(beng): set shader transform to match canvas transform. |
160 DrawRect(rect, paint); | 160 DrawRect(rect, paint); |
161 } | 161 } |
162 | 162 |
163 void CanvasSkia::DrawRect(const gfx::Rect& rect, const SkColor& color) { | 163 void CanvasSkia::DrawRect(const gfx::Rect& rect, const SkColor& color) { |
164 DrawRect(rect, color, SkXfermode::kSrcOver_Mode); | 164 DrawRect(rect, color, SkXfermode::kSrcOver_Mode); |
165 } | 165 } |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 | 427 |
428 CanvasPaint* CanvasPaint::CreateCanvasPaint(gfx::NativeView view) { | 428 CanvasPaint* CanvasPaint::CreateCanvasPaint(gfx::NativeView view) { |
429 #if defined(OS_WIN) && !defined(USE_AURA) | 429 #if defined(OS_WIN) && !defined(USE_AURA) |
430 return new CanvasPaintWin(view); | 430 return new CanvasPaintWin(view); |
431 #else | 431 #else |
432 return NULL; | 432 return NULL; |
433 #endif | 433 #endif |
434 } | 434 } |
435 | 435 |
436 } // namespace gfx | 436 } // namespace gfx |
OLD | NEW |