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

Side by Side Diff: cc/layers/heads_up_display_layer_impl.cc

Issue 1829093002: Use sk_sp-based APIs for SkColorFilter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Respond to reviews Created 4 years, 8 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/heads_up_display_layer_impl.h" 5 #include "cc/layers/heads_up_display_layer_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 22 matching lines...) Expand all
33 #include "ui/gfx/geometry/size.h" 33 #include "ui/gfx/geometry/size.h"
34 #include "ui/gfx/geometry/size_conversions.h" 34 #include "ui/gfx/geometry/size_conversions.h"
35 35
36 namespace cc { 36 namespace cc {
37 37
38 static inline SkPaint CreatePaint() { 38 static inline SkPaint CreatePaint() {
39 SkPaint paint; 39 SkPaint paint;
40 #if (SK_R32_SHIFT || SK_B32_SHIFT != 16) 40 #if (SK_R32_SHIFT || SK_B32_SHIFT != 16)
41 // The SkCanvas is in RGBA but the shader is expecting BGRA, so we need to 41 // The SkCanvas is in RGBA but the shader is expecting BGRA, so we need to
42 // swizzle our colors when drawing to the SkCanvas. 42 // swizzle our colors when drawing to the SkCanvas.
43 SkColorMatrix swizzle_matrix; 43 SkScalar color_matrix[20];
44 for (int i = 0; i < 20; ++i) 44 for (int i = 0; i < 20; ++i)
45 swizzle_matrix.fMat[i] = 0; 45 color_matrix[i] = 0;
46 swizzle_matrix.fMat[0 + 5 * 2] = 1; 46 color_matrix[0 + 5 * 2] = 1;
47 swizzle_matrix.fMat[1 + 5 * 1] = 1; 47 color_matrix[1 + 5 * 1] = 1;
48 swizzle_matrix.fMat[2 + 5 * 0] = 1; 48 color_matrix[2 + 5 * 0] = 1;
49 swizzle_matrix.fMat[3 + 5 * 3] = 1; 49 color_matrix[3 + 5 * 3] = 1;
50 50
51 skia::RefPtr<SkColorFilter> filter = 51 paint.setColorFilter(
52 skia::AdoptRef(SkColorMatrixFilter::Create(swizzle_matrix)); 52 SkColorFilter::MakeMatrixFilterRowMajor255(color_matrix));
53 paint.setColorFilter(filter.get());
54 #endif 53 #endif
55 return paint; 54 return paint;
56 } 55 }
57 56
58 HeadsUpDisplayLayerImpl::Graph::Graph(double indicator_value, 57 HeadsUpDisplayLayerImpl::Graph::Graph(double indicator_value,
59 double start_upper_bound) 58 double start_upper_bound)
60 : value(0.0), 59 : value(0.0),
61 min(0.0), 60 min(0.0),
62 max(0.0), 61 max(0.0),
63 current_upper_bound(start_upper_bound), 62 current_upper_bound(start_upper_bound),
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 return "cc::HeadsUpDisplayLayerImpl"; 808 return "cc::HeadsUpDisplayLayerImpl";
810 } 809 }
811 810
812 void HeadsUpDisplayLayerImpl::AsValueInto( 811 void HeadsUpDisplayLayerImpl::AsValueInto(
813 base::trace_event::TracedValue* dict) const { 812 base::trace_event::TracedValue* dict) const {
814 LayerImpl::AsValueInto(dict); 813 LayerImpl::AsValueInto(dict);
815 dict->SetString("layer_name", "Heads Up Display Layer"); 814 dict->SetString("layer_name", "Heads Up Display Layer");
816 } 815 }
817 816
818 } // namespace cc 817 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698