Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Side by Side Diff: cc/resources/transparency_display_item.cc

Issue 956813002: Remove unused transparency display items. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/resources/transparency_display_item.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "cc/resources/transparency_display_item.h"
6
7 #include "base/strings/stringprintf.h"
8 #include "base/trace_event/trace_event_argument.h"
9 #include "third_party/skia/include/core/SkCanvas.h"
10 #include "third_party/skia/include/core/SkPaint.h"
11 #include "third_party/skia/include/core/SkXfermode.h"
12 #include "ui/gfx/skia_util.h"
13
14 namespace cc {
15
16 TransparencyDisplayItem::TransparencyDisplayItem(float opacity,
17 SkXfermode::Mode blend_mode)
18 : opacity_(opacity), blend_mode_(blend_mode) {
19 }
20
21 TransparencyDisplayItem::~TransparencyDisplayItem() {
22 }
23
24 void TransparencyDisplayItem::Raster(SkCanvas* canvas,
25 SkDrawPictureCallback* callback) const {
26 SkPaint paint;
27 paint.setXfermodeMode(blend_mode_);
28 paint.setAlpha(opacity_ * 255);
29 canvas->saveLayer(NULL, &paint);
30 }
31
32 bool TransparencyDisplayItem::IsSuitableForGpuRasterization() const {
33 return true;
34 }
35
36 int TransparencyDisplayItem::ApproximateOpCount() const {
37 return 1;
38 }
39
40 size_t TransparencyDisplayItem::PictureMemoryUsage() const {
41 return sizeof(float) + sizeof(SkXfermode::Mode);
42 }
43
44 void TransparencyDisplayItem::AsValueInto(
45 base::trace_event::TracedValue* array) const {
46 array->AppendString(
47 base::StringPrintf("TransparencyDisplayItem opacity: %f, blend_mode: %d",
48 opacity_, blend_mode_));
49 }
50
51 EndTransparencyDisplayItem::EndTransparencyDisplayItem() {
52 }
53
54 EndTransparencyDisplayItem::~EndTransparencyDisplayItem() {
55 }
56
57 void EndTransparencyDisplayItem::Raster(SkCanvas* canvas,
58 SkDrawPictureCallback* callback) const {
59 canvas->restore();
60 }
61
62 bool EndTransparencyDisplayItem::IsSuitableForGpuRasterization() const {
63 return true;
64 }
65
66 int EndTransparencyDisplayItem::ApproximateOpCount() const {
67 return 0;
68 }
69
70 size_t EndTransparencyDisplayItem::PictureMemoryUsage() const {
71 return 0;
72 }
73
74 void EndTransparencyDisplayItem::AsValueInto(
75 base::trace_event::TracedValue* array) const {
76 array->AppendString("EndTransparencyDisplayItem");
77 }
78
79 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/transparency_display_item.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698