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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 void CanvasSkia::Save() { | 107 void CanvasSkia::Save() { |
108 canvas_->save(); | 108 canvas_->save(); |
109 } | 109 } |
110 | 110 |
111 void CanvasSkia::SaveLayerAlpha(uint8 alpha) { | 111 void CanvasSkia::SaveLayerAlpha(uint8 alpha) { |
112 canvas_->saveLayerAlpha(NULL, alpha); | 112 canvas_->saveLayerAlpha(NULL, alpha); |
113 } | 113 } |
114 | 114 |
115 | 115 |
116 void CanvasSkia::SaveLayerAlpha(uint8 alpha, const gfx::Rect& layer_bounds) { | 116 void CanvasSkia::SaveLayerAlpha(uint8 alpha, const gfx::Rect& layer_bounds) { |
117 SkRect bounds; | 117 SkRect bounds(gfx::RectToSkRect(layer_bounds)); |
118 bounds.set(SkIntToScalar(layer_bounds.x()), | |
119 SkIntToScalar(layer_bounds.y()), | |
120 SkIntToScalar(layer_bounds.right()), | |
121 SkIntToScalar(layer_bounds.bottom())); | |
122 canvas_->saveLayerAlpha(&bounds, alpha); | 118 canvas_->saveLayerAlpha(&bounds, alpha); |
123 } | 119 } |
124 | 120 |
125 void CanvasSkia::Restore() { | 121 void CanvasSkia::Restore() { |
126 canvas_->restore(); | 122 canvas_->restore(); |
127 } | 123 } |
128 | 124 |
129 bool CanvasSkia::ClipRect(const gfx::Rect& rect) { | 125 bool CanvasSkia::ClipRect(const gfx::Rect& rect) { |
130 return canvas_->clipRect(gfx::RectToSkRect(rect)); | 126 return canvas_->clipRect(gfx::RectToSkRect(rect)); |
131 } | 127 } |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 | 394 |
399 Canvas* Canvas::CreateCanvas() { | 395 Canvas* Canvas::CreateCanvas() { |
400 return new CanvasSkia; | 396 return new CanvasSkia; |
401 } | 397 } |
402 | 398 |
403 Canvas* Canvas::CreateCanvas(const gfx::Size& size, bool is_opaque) { | 399 Canvas* Canvas::CreateCanvas(const gfx::Size& size, bool is_opaque) { |
404 return new CanvasSkia(size, is_opaque); | 400 return new CanvasSkia(size, is_opaque); |
405 } | 401 } |
406 | 402 |
407 } // namespace gfx | 403 } // namespace gfx |
OLD | NEW |