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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/Pattern.cpp

Issue 2893083002: cc: Move SkShader construction to a single spot in PaintShader (Closed)
Patch Set: update Created 3 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 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Computer, Inc. All rights reserved.
3 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 3 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
4 * Copyright (C) 2013 Google, Inc. All rights reserved. 4 * Copyright (C) 2013 Google, Inc. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 Pattern::Pattern(RepeatMode repeat_mode) : repeat_mode_(repeat_mode) {} 50 Pattern::Pattern(RepeatMode repeat_mode) : repeat_mode_(repeat_mode) {}
51 51
52 Pattern::~Pattern() { 52 Pattern::~Pattern() {
53 } 53 }
54 54
55 void Pattern::ApplyToFlags(PaintFlags& flags, const SkMatrix& local_matrix) { 55 void Pattern::ApplyToFlags(PaintFlags& flags, const SkMatrix& local_matrix) {
56 if (!cached_shader_ || IsLocalMatrixChanged(local_matrix)) 56 if (!cached_shader_ || IsLocalMatrixChanged(local_matrix))
57 cached_shader_ = CreateShader(local_matrix); 57 cached_shader_ = CreateShader(local_matrix);
58 58
59 flags.setShader(cached_shader_); 59 flags.setShader(WTF::MakeUnique<PaintShader>(*cached_shader_));
60 } 60 }
61 61
62 bool Pattern::IsLocalMatrixChanged(const SkMatrix& local_matrix) const { 62 bool Pattern::IsLocalMatrixChanged(const SkMatrix& local_matrix) const {
63 return local_matrix != cached_shader_->getLocalMatrix(); 63 return local_matrix != cached_shader_->sk_shader()->getLocalMatrix();
enne (OOO) 2017/05/23 18:55:02 All of these sk_shader calls seem easy to avoid by
64 } 64 }
65 65
66 } // namespace blink 66 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698