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

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

Issue 1783613004: CC Animation: Erase cc::LayerSettings everywhere. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@eraseandroid
Patch Set: Rebase. Created 4 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
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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include "cc/layers/picture_image_layer.h" 7 #include "cc/layers/picture_image_layer.h"
8 #include "cc/layers/solid_color_layer.h" 8 #include "cc/layers/solid_color_layer.h"
9 #include "cc/test/layer_tree_pixel_resource_test.h" 9 #include "cc/test/layer_tree_pixel_resource_test.h"
10 #include "cc/test/pixel_comparator.h" 10 #include "cc/test/pixel_comparator.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 skia::RefPtr<SkSurface> backing_store = 134 skia::RefPtr<SkSurface> backing_store =
135 skia::AdoptRef(SkSurface::NewRasterN32Premul(width, height)); 135 skia::AdoptRef(SkSurface::NewRasterN32Premul(width, height));
136 SkCanvas* canvas = backing_store->getCanvas(); 136 SkCanvas* canvas = backing_store->getCanvas();
137 canvas->clear(SK_ColorTRANSPARENT); 137 canvas->clear(SK_ColorTRANSPARENT);
138 for (int i = 0; i < kCSSTestColorsCount; ++i) { 138 for (int i = 0; i < kCSSTestColorsCount; ++i) {
139 SkPaint paint; 139 SkPaint paint;
140 paint.setColor(kCSSTestColors[i]); 140 paint.setColor(kCSSTestColors[i]);
141 canvas->drawRect( 141 canvas->drawRect(
142 SkRect::MakeXYWH(0, i * kLaneHeight, kLaneWidth, kLaneHeight), paint); 142 SkRect::MakeXYWH(0, i * kLaneHeight, kLaneWidth, kLaneHeight), paint);
143 } 143 }
144 scoped_refptr<PictureImageLayer> layer = 144 scoped_refptr<PictureImageLayer> layer = PictureImageLayer::Create();
145 PictureImageLayer::Create(layer_settings());
146 layer->SetIsDrawable(true); 145 layer->SetIsDrawable(true);
147 layer->SetBounds(gfx::Size(width, height)); 146 layer->SetBounds(gfx::Size(width, height));
148 skia::RefPtr<const SkImage> image = 147 skia::RefPtr<const SkImage> image =
149 skia::AdoptRef(backing_store->newImageSnapshot()); 148 skia::AdoptRef(backing_store->newImageSnapshot());
150 layer->SetImage(std::move(image)); 149 layer->SetImage(std::move(image));
151 return layer; 150 return layer;
152 } 151 }
153 152
154 void SetupMaskLayer(scoped_refptr<Layer> layer) { 153 void SetupMaskLayer(scoped_refptr<Layer> layer) {
155 const int kMaskOffset = 2; 154 const int kMaskOffset = 2;
156 gfx::Size bounds = layer->bounds(); 155 gfx::Size bounds = layer->bounds();
157 scoped_refptr<PictureImageLayer> mask = 156 scoped_refptr<PictureImageLayer> mask = PictureImageLayer::Create();
158 PictureImageLayer::Create(layer_settings());
159 mask->SetIsDrawable(true); 157 mask->SetIsDrawable(true);
160 mask->SetIsMask(true); 158 mask->SetIsMask(true);
161 mask->SetBounds(bounds); 159 mask->SetBounds(bounds);
162 160
163 skia::RefPtr<SkSurface> surface = skia::AdoptRef( 161 skia::RefPtr<SkSurface> surface = skia::AdoptRef(
164 SkSurface::NewRasterN32Premul(bounds.width(), bounds.height())); 162 SkSurface::NewRasterN32Premul(bounds.width(), bounds.height()));
165 SkCanvas* canvas = surface->getCanvas(); 163 SkCanvas* canvas = surface->getCanvas();
166 SkPaint paint; 164 SkPaint paint;
167 paint.setColor(SK_ColorWHITE); 165 paint.setColor(SK_ColorWHITE);
168 canvas->clear(SK_ColorTRANSPARENT); 166 canvas->clear(SK_ColorTRANSPARENT);
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 RunBlendingWithRenderPass( 496 RunBlendingWithRenderPass(
499 GL_ZERO_COPY_RECT_DRAW, 497 GL_ZERO_COPY_RECT_DRAW,
500 FILE_PATH_LITERAL("blending_render_pass_mask.png"), 498 FILE_PATH_LITERAL("blending_render_pass_mask.png"),
501 kUseMasks | kUseAntialiasing | kUseColorMatrix | kForceShaders); 499 kUseMasks | kUseAntialiasing | kUseColorMatrix | kForceShaders);
502 } 500 }
503 501
504 } // namespace 502 } // namespace
505 } // namespace cc 503 } // namespace cc
506 504
507 #endif // OS_ANDROID 505 #endif // OS_ANDROID
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698