| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "cc/resources/transparency_display_item.h" | 5 #include "cc/resources/transparency_display_item.h" |
| 6 | 6 |
| 7 #include "base/strings/stringprintf.h" |
| 8 #include "base/trace_event/trace_event_argument.h" |
| 7 #include "third_party/skia/include/core/SkCanvas.h" | 9 #include "third_party/skia/include/core/SkCanvas.h" |
| 8 #include "third_party/skia/include/core/SkPaint.h" | 10 #include "third_party/skia/include/core/SkPaint.h" |
| 9 #include "third_party/skia/include/core/SkXfermode.h" | 11 #include "third_party/skia/include/core/SkXfermode.h" |
| 10 #include "ui/gfx/skia_util.h" | 12 #include "ui/gfx/skia_util.h" |
| 11 | 13 |
| 12 namespace cc { | 14 namespace cc { |
| 13 | 15 |
| 14 TransparencyDisplayItem::TransparencyDisplayItem(float opacity, | 16 TransparencyDisplayItem::TransparencyDisplayItem(float opacity, |
| 15 SkXfermode::Mode blend_mode) | 17 SkXfermode::Mode blend_mode) |
| 16 : opacity_(opacity), blend_mode_(blend_mode) { | 18 : opacity_(opacity), blend_mode_(blend_mode) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 32 } | 34 } |
| 33 | 35 |
| 34 int TransparencyDisplayItem::ApproximateOpCount() const { | 36 int TransparencyDisplayItem::ApproximateOpCount() const { |
| 35 return 1; | 37 return 1; |
| 36 } | 38 } |
| 37 | 39 |
| 38 size_t TransparencyDisplayItem::PictureMemoryUsage() const { | 40 size_t TransparencyDisplayItem::PictureMemoryUsage() const { |
| 39 return sizeof(float) + sizeof(SkXfermode::Mode); | 41 return sizeof(float) + sizeof(SkXfermode::Mode); |
| 40 } | 42 } |
| 41 | 43 |
| 44 void TransparencyDisplayItem::AsValueInto( |
| 45 base::debug::TracedValue* array) const { |
| 46 array->AppendString( |
| 47 base::StringPrintf("TransparencyDisplayItem opacity: %f, blend_mode: %d", |
| 48 opacity_, blend_mode_)); |
| 49 } |
| 50 |
| 42 EndTransparencyDisplayItem::EndTransparencyDisplayItem() { | 51 EndTransparencyDisplayItem::EndTransparencyDisplayItem() { |
| 43 } | 52 } |
| 44 | 53 |
| 45 EndTransparencyDisplayItem::~EndTransparencyDisplayItem() { | 54 EndTransparencyDisplayItem::~EndTransparencyDisplayItem() { |
| 46 } | 55 } |
| 47 | 56 |
| 48 void EndTransparencyDisplayItem::Raster(SkCanvas* canvas, | 57 void EndTransparencyDisplayItem::Raster(SkCanvas* canvas, |
| 49 SkDrawPictureCallback* callback) const { | 58 SkDrawPictureCallback* callback) const { |
| 50 canvas->restore(); | 59 canvas->restore(); |
| 51 } | 60 } |
| 52 | 61 |
| 53 bool EndTransparencyDisplayItem::IsSuitableForGpuRasterization() const { | 62 bool EndTransparencyDisplayItem::IsSuitableForGpuRasterization() const { |
| 54 return true; | 63 return true; |
| 55 } | 64 } |
| 56 | 65 |
| 57 int EndTransparencyDisplayItem::ApproximateOpCount() const { | 66 int EndTransparencyDisplayItem::ApproximateOpCount() const { |
| 58 return 0; | 67 return 0; |
| 59 } | 68 } |
| 60 | 69 |
| 61 size_t EndTransparencyDisplayItem::PictureMemoryUsage() const { | 70 size_t EndTransparencyDisplayItem::PictureMemoryUsage() const { |
| 62 return 0; | 71 return 0; |
| 63 } | 72 } |
| 64 | 73 |
| 74 void EndTransparencyDisplayItem::AsValueInto( |
| 75 base::debug::TracedValue* array) const { |
| 76 array->AppendString("EndTransparencyDisplayItem"); |
| 77 } |
| 78 |
| 65 } // namespace cc | 79 } // namespace cc |
| OLD | NEW |