Delete chrome.mediaGalleriesPrivate because the functionality unique to it has since...
[chromium-blink-merge.git] / cc / resources / transparency_display_item.cc
blob0401d90f74e6f972d66e5ca4c6a3510ddcb35d5c
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.
5 #include "cc/resources/transparency_display_item.h"
7 #include "third_party/skia/include/core/SkCanvas.h"
8 #include "third_party/skia/include/core/SkPaint.h"
9 #include "third_party/skia/include/core/SkXfermode.h"
10 #include "ui/gfx/skia_util.h"
12 namespace cc {
14 TransparencyDisplayItem::TransparencyDisplayItem(float opacity,
15 SkXfermode::Mode blend_mode)
16 : opacity_(opacity), blend_mode_(blend_mode) {
19 TransparencyDisplayItem::~TransparencyDisplayItem() {
22 void TransparencyDisplayItem::Raster(SkCanvas* canvas,
23 SkDrawPictureCallback* callback) const {
24 SkPaint paint;
25 paint.setXfermodeMode(blend_mode_);
26 paint.setAlpha(opacity_ * 255);
27 canvas->saveLayer(NULL, &paint);
30 bool TransparencyDisplayItem::IsSuitableForGpuRasterization() const {
31 return true;
34 int TransparencyDisplayItem::ApproximateOpCount() const {
35 return 1;
38 size_t TransparencyDisplayItem::PictureMemoryUsage() const {
39 return sizeof(float) + sizeof(SkXfermode::Mode);
42 EndTransparencyDisplayItem::EndTransparencyDisplayItem() {
45 EndTransparencyDisplayItem::~EndTransparencyDisplayItem() {
48 void EndTransparencyDisplayItem::Raster(SkCanvas* canvas,
49 SkDrawPictureCallback* callback) const {
50 canvas->restore();
53 bool EndTransparencyDisplayItem::IsSuitableForGpuRasterization() const {
54 return true;
57 int EndTransparencyDisplayItem::ApproximateOpCount() const {
58 return 0;
61 size_t EndTransparencyDisplayItem::PictureMemoryUsage() const {
62 return 0;
65 } // namespace cc