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

Side by Side Diff: cc/output/filter_operation.cc

Issue 16968002: Move implementation of WebFilterOperations into cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "cc/output/filter_operation.h"
6
7 namespace cc {
8
9 bool FilterOperation::operator==(const FilterOperation& other) const {
10 if (type_ != other.type_)
11 return false;
12 if (type_ == FilterTypeColorMatrix)
13 return !memcmp(matrix_, other.matrix_, sizeof(matrix_));
14 if (type_ == FilterTypeDropShadow) {
15 return amount_ == other.amount_ &&
16 drop_shadow_offset_ == other.drop_shadow_offset_ &&
17 drop_shadow_color_ == other.drop_shadow_color_;
18 }
19 return amount_ == other.amount_;
20 }
21
22 FilterOperation::FilterOperation(FilterType type, float amount)
23 : type_(type),
24 amount_(amount),
25 drop_shadow_offset_(0, 0),
26 drop_shadow_color_(0),
27 zoom_inset_(0) {
28 DCHECK(type_ != FilterTypeDropShadow && type_ != FilterTypeColorMatrix);
jamesr 2013/06/18 23:08:52 would be better as two checks using DCHECK_NE
ajuma 2013/06/19 17:08:30 Done.
29 memset(matrix_, 0, sizeof(matrix_));
30 }
31
32 FilterOperation::FilterOperation(FilterType type,
33 gfx::Point offset,
34 float stdDeviation,
35 SkColor color)
36 : type_(type),
37 amount_(stdDeviation),
38 drop_shadow_offset_(offset),
39 drop_shadow_color_(color),
40 zoom_inset_(0) {
41 DCHECK(type_ == FilterTypeDropShadow);
42 memset(matrix_, 0, sizeof(matrix_));
43 }
44
45 FilterOperation::FilterOperation(FilterType type, SkScalar matrix[20])
46 : type_(type),
47 amount_(0),
48 drop_shadow_offset_(0, 0),
49 drop_shadow_color_(0),
50 zoom_inset_(0) {
51 DCHECK(type_ == FilterTypeColorMatrix);
52 memcpy(matrix_, matrix, sizeof(matrix_));
53 }
54
55 FilterOperation::FilterOperation(FilterType type, float amount, int inset)
56 : type_(type),
57 amount_(amount),
58 drop_shadow_offset_(0, 0),
59 drop_shadow_color_(0),
60 zoom_inset_(inset) {
61 DCHECK(type_ == FilterTypeZoom);
62 memset(matrix_, 0, sizeof(matrix_));
63 }
64
65 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698