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

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

Issue 1819683002: Use sk_sp-based picture recording APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 <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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 canvas->drawRect( 54 canvas->drawRect(
55 SkRect::MakeXYWH(inset_rect.x(), inset_rect.y(), 55 SkRect::MakeXYWH(inset_rect.x(), inset_rect.y(),
56 inset_rect.width(), inset_rect.height()), 56 inset_rect.width(), inset_rect.height()),
57 paint); 57 paint);
58 inset_rect.Inset(3, 3, 2, 2); 58 inset_rect.Inset(3, 3, 2, 2);
59 } 59 }
60 60
61 scoped_refptr<DisplayItemList> display_list = 61 scoped_refptr<DisplayItemList> display_list =
62 DisplayItemList::Create(PaintableRegion(), DisplayItemListSettings()); 62 DisplayItemList::Create(PaintableRegion(), DisplayItemListSettings());
63 display_list->CreateAndAppendItem<DrawingDisplayItem>( 63 display_list->CreateAndAppendItem<DrawingDisplayItem>(
64 PaintableRegion(), skia::AdoptRef(recorder.endRecordingAsPicture())); 64 PaintableRegion(), recorder.finishRecordingAsPicture());
65 65
66 display_list->Finalize(); 66 display_list->Finalize();
67 return display_list; 67 return display_list;
68 } 68 }
69 69
70 private: 70 private:
71 gfx::Size bounds_; 71 gfx::Size bounds_;
72 }; 72 };
73 73
74 TEST_P(LayerTreeHostMasksPixelTest, MaskOfLayer) { 74 TEST_P(LayerTreeHostMasksPixelTest, MaskOfLayer) {
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 } 322 }
323 } else { 323 } else {
324 for (int i = 4; i < bounds_.height(); i += 16) { 324 for (int i = 4; i < bounds_.height(); i += 16) {
325 canvas->drawLine(0, i, bounds_.width(), i, paint); 325 canvas->drawLine(0, i, bounds_.width(), i, paint);
326 } 326 }
327 } 327 }
328 328
329 scoped_refptr<DisplayItemList> display_list = 329 scoped_refptr<DisplayItemList> display_list =
330 DisplayItemList::Create(PaintableRegion(), DisplayItemListSettings()); 330 DisplayItemList::Create(PaintableRegion(), DisplayItemListSettings());
331 display_list->CreateAndAppendItem<DrawingDisplayItem>( 331 display_list->CreateAndAppendItem<DrawingDisplayItem>(
332 PaintableRegion(), skia::AdoptRef(recorder.endRecordingAsPicture())); 332 PaintableRegion(), recorder.finishRecordingAsPicture());
333 333
334 display_list->Finalize(); 334 display_list->Finalize();
335 return display_list; 335 return display_list;
336 } 336 }
337 337
338 private: 338 private:
339 gfx::Size bounds_; 339 gfx::Size bounds_;
340 SkColor color_; 340 SkColor color_;
341 bool vertical_; 341 bool vertical_;
342 }; 342 };
(...skipping 17 matching lines...) Expand all
360 paint.setColor(SK_ColorWHITE); 360 paint.setColor(SK_ColorWHITE);
361 canvas->clear(SK_ColorTRANSPARENT); 361 canvas->clear(SK_ColorTRANSPARENT);
362 canvas->drawCircle(bounds_.width() / 2, 362 canvas->drawCircle(bounds_.width() / 2,
363 bounds_.height() / 2, 363 bounds_.height() / 2,
364 bounds_.width() / 4, 364 bounds_.width() / 4,
365 paint); 365 paint);
366 366
367 scoped_refptr<DisplayItemList> display_list = 367 scoped_refptr<DisplayItemList> display_list =
368 DisplayItemList::Create(PaintableRegion(), DisplayItemListSettings()); 368 DisplayItemList::Create(PaintableRegion(), DisplayItemListSettings());
369 display_list->CreateAndAppendItem<DrawingDisplayItem>( 369 display_list->CreateAndAppendItem<DrawingDisplayItem>(
370 PaintableRegion(), skia::AdoptRef(recorder.endRecordingAsPicture())); 370 PaintableRegion(), recorder.finishRecordingAsPicture());
371 371
372 display_list->Finalize(); 372 display_list->Finalize();
373 return display_list; 373 return display_list;
374 } 374 }
375 375
376 private: 376 private:
377 gfx::Size bounds_; 377 gfx::Size bounds_;
378 }; 378 };
379 379
380 using LayerTreeHostMasksForBackgroundFiltersPixelTest = 380 using LayerTreeHostMasksForBackgroundFiltersPixelTest =
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 485
486 RunPixelResourceTest(background, 486 RunPixelResourceTest(background,
487 base::FilePath( 487 base::FilePath(
488 FILE_PATH_LITERAL("mask_of_layer_with_blend.png"))); 488 FILE_PATH_LITERAL("mask_of_layer_with_blend.png")));
489 } 489 }
490 490
491 } // namespace 491 } // namespace
492 } // namespace cc 492 } // namespace cc
493 493
494 #endif // !defined(OS_ANDROID) 494 #endif // !defined(OS_ANDROID)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698