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

Side by Side Diff: src/pdf/SkPDFGraphicState.cpp

Issue 12393049: Added support for non-separable blending modes and fixed scalar issue (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/core/SkXfermode.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkPDFFormXObject.h" 8 #include "SkPDFFormXObject.h"
9 #include "SkPDFGraphicState.h" 9 #include "SkPDFGraphicState.h"
10 #include "SkPDFUtils.h" 10 #include "SkPDFUtils.h"
11 #include "SkStream.h" 11 #include "SkStream.h"
12 #include "SkTypes.h" 12 #include "SkTypes.h"
13 13
14 static const char* blend_mode_from_xfermode(SkXfermode::Mode mode) { 14 static const char* blend_mode_from_xfermode(SkXfermode::Mode mode) {
15 switch (mode) { 15 switch (mode) {
16 case SkXfermode::kSrcOver_Mode: return "Normal"; 16 case SkXfermode::kSrcOver_Mode: return "Normal";
17 case SkXfermode::kModulate_Mode: return "Multiply"; 17 // kModulate is not really like multipy but similar most of the time.
18 case SkXfermode::kModulate_Mode:
19 case SkXfermode::kMultiply_Mode: return "Multiply";
18 case SkXfermode::kScreen_Mode: return "Screen"; 20 case SkXfermode::kScreen_Mode: return "Screen";
19 case SkXfermode::kOverlay_Mode: return "Overlay"; 21 case SkXfermode::kOverlay_Mode: return "Overlay";
20 case SkXfermode::kDarken_Mode: return "Darken"; 22 case SkXfermode::kDarken_Mode: return "Darken";
21 case SkXfermode::kLighten_Mode: return "Lighten"; 23 case SkXfermode::kLighten_Mode: return "Lighten";
22 case SkXfermode::kColorDodge_Mode: return "ColorDodge"; 24 case SkXfermode::kColorDodge_Mode: return "ColorDodge";
23 case SkXfermode::kColorBurn_Mode: return "ColorBurn"; 25 case SkXfermode::kColorBurn_Mode: return "ColorBurn";
24 case SkXfermode::kHardLight_Mode: return "HardLight"; 26 case SkXfermode::kHardLight_Mode: return "HardLight";
25 case SkXfermode::kSoftLight_Mode: return "SoftLight"; 27 case SkXfermode::kSoftLight_Mode: return "SoftLight";
26 case SkXfermode::kDifference_Mode: return "Difference"; 28 case SkXfermode::kDifference_Mode: return "Difference";
27 case SkXfermode::kExclusion_Mode: return "Exclusion"; 29 case SkXfermode::kExclusion_Mode: return "Exclusion";
30 case SkXfermode::kHue_Mode: return "Hue";
31 case SkXfermode::kSaturation_Mode: return "Saturation";
32 case SkXfermode::kColor_Mode: return "Color";
33 case SkXfermode::kLuminosity_Mode: return "Luminosity";
28 34
29 // These are handled in SkPDFDevice::setUpContentEntry. 35 // These are handled in SkPDFDevice::setUpContentEntry.
30 case SkXfermode::kClear_Mode: 36 case SkXfermode::kClear_Mode:
31 case SkXfermode::kSrc_Mode: 37 case SkXfermode::kSrc_Mode:
32 case SkXfermode::kDst_Mode: 38 case SkXfermode::kDst_Mode:
33 case SkXfermode::kDstOver_Mode: 39 case SkXfermode::kDstOver_Mode:
34 case SkXfermode::kSrcIn_Mode: 40 case SkXfermode::kSrcIn_Mode:
35 case SkXfermode::kDstIn_Mode: 41 case SkXfermode::kDstIn_Mode:
36 case SkXfermode::kSrcOut_Mode: 42 case SkXfermode::kSrcOut_Mode:
37 case SkXfermode::kDstOut_Mode: 43 case SkXfermode::kDstOut_Mode:
38 return "Normal"; 44 return "Normal";
39 45
40 // TODO(vandebo): Figure out if we can support more of these modes. 46 // TODO(vandebo): Figure out if we can support more of these modes.
41 case SkXfermode::kSrcATop_Mode: 47 case SkXfermode::kSrcATop_Mode:
42 case SkXfermode::kDstATop_Mode: 48 case SkXfermode::kDstATop_Mode:
43 case SkXfermode::kXor_Mode: 49 case SkXfermode::kXor_Mode:
44 case SkXfermode::kPlus_Mode: 50 case SkXfermode::kPlus_Mode:
45 case SkXfermode::kMultiply_Mode:
46 return NULL; 51 return NULL;
47 } 52 }
48 return NULL; 53 return NULL;
49 } 54 }
50 55
51 SkPDFGraphicState::~SkPDFGraphicState() { 56 SkPDFGraphicState::~SkPDFGraphicState() {
52 SkAutoMutexAcquire lock(CanonicalPaintsMutex()); 57 SkAutoMutexAcquire lock(CanonicalPaintsMutex());
53 if (!fSMask) { 58 if (!fSMask) {
54 int index = Find(fPaint); 59 int index = Find(fPaint);
55 SkASSERT(index >= 0); 60 SkASSERT(index >= 0);
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 } 274 }
270 if (bXfermodeName < 0 || bXfermodeName > SkXfermode::kLastMode || 275 if (bXfermodeName < 0 || bXfermodeName > SkXfermode::kLastMode ||
271 blend_mode_from_xfermode(bXfermodeName) == NULL) { 276 blend_mode_from_xfermode(bXfermodeName) == NULL) {
272 bXfermodeName = SkXfermode::kSrcOver_Mode; 277 bXfermodeName = SkXfermode::kSrcOver_Mode;
273 } 278 }
274 const char* bXfermodeString = blend_mode_from_xfermode(bXfermodeName); 279 const char* bXfermodeString = blend_mode_from_xfermode(bXfermodeName);
275 SkASSERT(bXfermodeString != NULL); 280 SkASSERT(bXfermodeString != NULL);
276 281
277 return strcmp(aXfermodeString, bXfermodeString) == 0; 282 return strcmp(aXfermodeString, bXfermodeString) == 0;
278 } 283 }
OLDNEW
« no previous file with comments | « src/core/SkXfermode.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698