OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "gfx/canvas_skia.h" | 5 #include "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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 98 |
99 void CanvasSkia::TranslateInt(int x, int y) { | 99 void CanvasSkia::TranslateInt(int x, int y) { |
100 translate(SkIntToScalar(x), SkIntToScalar(y)); | 100 translate(SkIntToScalar(x), SkIntToScalar(y)); |
101 } | 101 } |
102 | 102 |
103 void CanvasSkia::ScaleInt(int x, int y) { | 103 void CanvasSkia::ScaleInt(int x, int y) { |
104 scale(SkIntToScalar(x), SkIntToScalar(y)); | 104 scale(SkIntToScalar(x), SkIntToScalar(y)); |
105 } | 105 } |
106 | 106 |
107 void CanvasSkia::FillRectInt(const SkColor& color, int x, int y, int w, int h) { | 107 void CanvasSkia::FillRectInt(const SkColor& color, int x, int y, int w, int h) { |
| 108 FillRectInt(color, x, y, w, h, SkXfermode::kSrcOver_Mode); |
| 109 } |
| 110 |
| 111 void CanvasSkia::FillRectInt(const SkColor& color, |
| 112 int x, int y, int w, int h, |
| 113 SkXfermode::Mode mode) { |
108 SkPaint paint; | 114 SkPaint paint; |
109 paint.setColor(color); | 115 paint.setColor(color); |
110 paint.setStyle(SkPaint::kFill_Style); | 116 paint.setStyle(SkPaint::kFill_Style); |
111 paint.setXfermodeMode(SkXfermode::kSrcOver_Mode); | 117 paint.setXfermodeMode(mode); |
112 DrawRectInt(x, y, w, h, paint); | 118 DrawRectInt(x, y, w, h, paint); |
113 } | 119 } |
114 | 120 |
115 void CanvasSkia::FillRectInt(const gfx::Brush* brush, | 121 void CanvasSkia::FillRectInt(const gfx::Brush* brush, |
116 int x, int y, int w, int h) { | 122 int x, int y, int w, int h) { |
117 const SkiaShader* shader = static_cast<const SkiaShader*>(brush); | 123 const SkiaShader* shader = static_cast<const SkiaShader*>(brush); |
118 SkPaint paint; | 124 SkPaint paint; |
119 paint.setShader(shader->shader()); | 125 paint.setShader(shader->shader()); |
120 // TODO(beng): set shader transform to match canvas transform. | 126 // TODO(beng): set shader transform to match canvas transform. |
121 DrawRectInt(x, y, w, h, paint); | 127 DrawRectInt(x, y, w, h, paint); |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 | 382 |
377 CanvasPaint* CanvasPaint::CreateCanvasPaint(gfx::NativeView view) { | 383 CanvasPaint* CanvasPaint::CreateCanvasPaint(gfx::NativeView view) { |
378 #if defined(OS_WIN) | 384 #if defined(OS_WIN) |
379 return new CanvasPaintWin(view); | 385 return new CanvasPaintWin(view); |
380 #else | 386 #else |
381 return NULL; | 387 return NULL; |
382 #endif | 388 #endif |
383 } | 389 } |
384 | 390 |
385 } // namespace gfx | 391 } // namespace gfx |
OLD | NEW |