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

Side by Side Diff: cc/trees/layer_tree_host_pixeltest_masks.cc

Issue 2710153004: cc: Fix up code to work with concrete cc paint types (Closed)
Patch Set: Rebase Created 3 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/trees/layer_tree_host_pixeltest_filters.cc ('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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "cc/layers/content_layer_client.h" 8 #include "cc/layers/content_layer_client.h"
9 #include "cc/layers/picture_image_layer.h" 9 #include "cc/layers/picture_image_layer.h"
10 #include "cc/layers/picture_layer.h" 10 #include "cc/layers/picture_layer.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 gfx::Rect(100, 100), SK_ColorWHITE); 96 gfx::Rect(100, 100), SK_ColorWHITE);
97 97
98 gfx::Size mask_bounds(50, 50); 98 gfx::Size mask_bounds(50, 50);
99 99
100 scoped_refptr<PictureImageLayer> mask = PictureImageLayer::Create(); 100 scoped_refptr<PictureImageLayer> mask = PictureImageLayer::Create();
101 mask->SetIsDrawable(true); 101 mask->SetIsDrawable(true);
102 mask->SetLayerMaskType(Layer::LayerMaskType::MULTI_TEXTURE_MASK); 102 mask->SetLayerMaskType(Layer::LayerMaskType::MULTI_TEXTURE_MASK);
103 mask->SetBounds(mask_bounds); 103 mask->SetBounds(mask_bounds);
104 104
105 sk_sp<SkSurface> surface = SkSurface::MakeRasterN32Premul(200, 200); 105 sk_sp<SkSurface> surface = SkSurface::MakeRasterN32Premul(200, 200);
106 PaintCanvas* canvas = surface->getCanvas(); 106 SkCanvas* canvas = surface->getCanvas();
107 canvas->scale(SkIntToScalar(4), SkIntToScalar(4)); 107 canvas->scale(SkIntToScalar(4), SkIntToScalar(4));
108 MaskContentLayerClient client(mask_bounds); 108 MaskContentLayerClient client(mask_bounds);
109 scoped_refptr<DisplayItemList> mask_display_list = 109 scoped_refptr<DisplayItemList> mask_display_list =
110 client.PaintContentsToDisplayList( 110 client.PaintContentsToDisplayList(
111 ContentLayerClient::PAINTING_BEHAVIOR_NORMAL); 111 ContentLayerClient::PAINTING_BEHAVIOR_NORMAL);
112 mask_display_list->Raster(canvas, nullptr); 112 mask_display_list->Raster(canvas, nullptr);
113 mask->SetImage(surface->makeImageSnapshot()); 113 mask->SetImage(surface->makeImageSnapshot());
114 114
115 scoped_refptr<SolidColorLayer> green = CreateSolidColorLayerWithBorder( 115 scoped_refptr<SolidColorLayer> green = CreateSolidColorLayerWithBorder(
116 gfx::Rect(25, 25, 50, 50), kCSSGreen, 1, SK_ColorBLACK); 116 gfx::Rect(25, 25, 50, 50), kCSSGreen, 1, SK_ColorBLACK);
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 335
336 RunPixelResourceTest(background, 336 RunPixelResourceTest(background,
337 base::FilePath( 337 base::FilePath(
338 FILE_PATH_LITERAL("mask_of_layer_with_blend.png"))); 338 FILE_PATH_LITERAL("mask_of_layer_with_blend.png")));
339 } 339 }
340 340
341 } // namespace 341 } // namespace
342 } // namespace cc 342 } // namespace cc
343 343
344 #endif // !defined(OS_ANDROID) 344 #endif // !defined(OS_ANDROID)
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_pixeltest_filters.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698