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

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

Issue 1122393003: CC: Plumb LayerSettings parameter for cc::Layer construction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 7 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
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 "cc/layers/picture_image_layer.h" 5 #include "cc/layers/picture_image_layer.h"
6 #include "cc/layers/solid_color_layer.h" 6 #include "cc/layers/solid_color_layer.h"
7 #include "cc/test/layer_tree_pixel_resource_test.h" 7 #include "cc/test/layer_tree_pixel_resource_test.h"
8 #include "cc/test/pixel_comparator.h" 8 #include "cc/test/pixel_comparator.h"
9 9
10 #if !defined(OS_ANDROID) 10 #if !defined(OS_ANDROID)
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 SkBitmap backing_store; 130 SkBitmap backing_store;
131 backing_store.allocN32Pixels(width, height); 131 backing_store.allocN32Pixels(width, height);
132 SkCanvas canvas(backing_store); 132 SkCanvas canvas(backing_store);
133 canvas.clear(SK_ColorTRANSPARENT); 133 canvas.clear(SK_ColorTRANSPARENT);
134 for (int i = 0; i < kCSSTestColorsCount; ++i) { 134 for (int i = 0; i < kCSSTestColorsCount; ++i) {
135 SkPaint paint; 135 SkPaint paint;
136 paint.setColor(kCSSTestColors[i]); 136 paint.setColor(kCSSTestColors[i]);
137 canvas.drawRect( 137 canvas.drawRect(
138 SkRect::MakeXYWH(0, i * kLaneHeight, kLaneWidth, kLaneHeight), paint); 138 SkRect::MakeXYWH(0, i * kLaneHeight, kLaneWidth, kLaneHeight), paint);
139 } 139 }
140 scoped_refptr<PictureImageLayer> layer = PictureImageLayer::Create(); 140 scoped_refptr<PictureImageLayer> layer =
141 PictureImageLayer::Create(layer_settings());
141 layer->SetIsDrawable(true); 142 layer->SetIsDrawable(true);
142 layer->SetBounds(gfx::Size(width, height)); 143 layer->SetBounds(gfx::Size(width, height));
143 layer->SetBitmap(backing_store); 144 layer->SetBitmap(backing_store);
144 return layer; 145 return layer;
145 } 146 }
146 147
147 void SetupMaskLayer(scoped_refptr<Layer> layer) { 148 void SetupMaskLayer(scoped_refptr<Layer> layer) {
148 const int kMaskOffset = 2; 149 const int kMaskOffset = 2;
149 gfx::Size bounds = layer->bounds(); 150 gfx::Size bounds = layer->bounds();
150 scoped_refptr<PictureImageLayer> mask = PictureImageLayer::Create(); 151 scoped_refptr<PictureImageLayer> mask =
152 PictureImageLayer::Create(layer_settings());
151 mask->SetIsDrawable(true); 153 mask->SetIsDrawable(true);
152 mask->SetIsMask(true); 154 mask->SetIsMask(true);
153 mask->SetBounds(bounds); 155 mask->SetBounds(bounds);
154 156
155 SkBitmap bitmap; 157 SkBitmap bitmap;
156 bitmap.allocN32Pixels(bounds.width(), bounds.height()); 158 bitmap.allocN32Pixels(bounds.width(), bounds.height());
157 SkCanvas canvas(bitmap); 159 SkCanvas canvas(bitmap);
158 SkPaint paint; 160 SkPaint paint;
159 paint.setColor(SK_ColorWHITE); 161 paint.setColor(SK_ColorWHITE);
160 canvas.clear(SK_ColorTRANSPARENT); 162 canvas.clear(SK_ColorTRANSPARENT);
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 RunBlendingWithRenderPass( 491 RunBlendingWithRenderPass(
490 GL_ASYNC_UPLOAD_2D_DRAW, 492 GL_ASYNC_UPLOAD_2D_DRAW,
491 FILE_PATH_LITERAL("blending_render_pass_mask.png"), 493 FILE_PATH_LITERAL("blending_render_pass_mask.png"),
492 kUseMasks | kUseAntialiasing | kUseColorMatrix | kForceShaders); 494 kUseMasks | kUseAntialiasing | kUseColorMatrix | kForceShaders);
493 } 495 }
494 496
495 } // namespace 497 } // namespace
496 } // namespace cc 498 } // namespace cc
497 499
498 #endif // OS_ANDROID 500 #endif // OS_ANDROID
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_common_unittest.cc ('k') | cc/trees/layer_tree_host_pixeltest_masks.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698