Chromium Code Reviews| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 47 | 47 |
| 48 namespace gfx { | 48 namespace gfx { |
| 49 | 49 |
| 50 //////////////////////////////////////////////////////////////////////////////// | 50 //////////////////////////////////////////////////////////////////////////////// |
| 51 // CanvasSkia, public: | 51 // CanvasSkia, public: |
| 52 | 52 |
| 53 CanvasSkia::CanvasSkia(const gfx::Size& size, bool is_opaque) | 53 CanvasSkia::CanvasSkia(const gfx::Size& size, bool is_opaque) |
| 54 : owned_canvas_(new skia::PlatformCanvas(size.width(), size.height(), | 54 : owned_canvas_(new skia::PlatformCanvas(size.width(), size.height(), |
| 55 is_opaque)), | 55 is_opaque)), |
| 56 canvas_(owned_canvas_.get()) { | 56 canvas_(owned_canvas_.get()) { |
| 57 #if defined(OS_WIN) || defined(OS_MACOSX) | |
| 58 owned_canvas_->clear(SkColorSetARGB(0, 0, 0, 0)); | |
|
vandebo (ex-Chrome)
2012/03/14 23:38:29
Why is this clear needed - this doesn't appear to
Jeff Timanus
2012/03/15 19:01:28
I put a clear here to preserve existing behaviour.
| |
| 59 #endif | |
| 57 } | 60 } |
| 58 | 61 |
| 59 CanvasSkia::CanvasSkia(const SkBitmap& bitmap, bool is_opaque) | 62 CanvasSkia::CanvasSkia(const SkBitmap& bitmap, bool is_opaque) |
| 60 : owned_canvas_(new skia::PlatformCanvas(bitmap.width(), bitmap.height(), | 63 : owned_canvas_(new skia::PlatformCanvas(bitmap.width(), bitmap.height(), |
| 61 is_opaque)), | 64 is_opaque)), |
| 62 canvas_(owned_canvas_.get()) { | 65 canvas_(owned_canvas_.get()) { |
| 63 DrawBitmapInt(bitmap, 0, 0); | 66 DrawBitmapInt(bitmap, 0, 0); |
| 64 } | 67 } |
| 65 | 68 |
| 66 CanvasSkia::CanvasSkia() | 69 CanvasSkia::CanvasSkia() |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 382 // CanvasSkia, private: | 385 // CanvasSkia, private: |
| 383 | 386 |
| 384 bool CanvasSkia::IntersectsClipRectInt(int x, int y, int w, int h) { | 387 bool CanvasSkia::IntersectsClipRectInt(int x, int y, int w, int h) { |
| 385 SkRect clip; | 388 SkRect clip; |
| 386 return canvas_->getClipBounds(&clip) && | 389 return canvas_->getClipBounds(&clip) && |
| 387 clip.intersect(SkIntToScalar(x), SkIntToScalar(y), SkIntToScalar(x + w), | 390 clip.intersect(SkIntToScalar(x), SkIntToScalar(y), SkIntToScalar(x + w), |
| 388 SkIntToScalar(y + h)); | 391 SkIntToScalar(y + h)); |
| 389 } | 392 } |
| 390 | 393 |
| 391 } // namespace gfx | 394 } // namespace gfx |
| OLD | NEW |