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

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

Issue 18585002: Implemented transparent gradients (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: More code review fixes. Created 7 years, 5 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
« src/pdf/SkPDFShader.cpp ('K') | « src/pdf/SkPDFUtils.h ('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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkData.h" 10 #include "SkData.h"
11 #include "SkGeometry.h" 11 #include "SkGeometry.h"
12 #include "SkPaint.h" 12 #include "SkPaint.h"
13 #include "SkPath.h" 13 #include "SkPath.h"
14 #include "SkPDFUtils.h" 14 #include "SkPDFUtils.h"
15 #include "SkStream.h" 15 #include "SkStream.h"
16 #include "SkString.h" 16 #include "SkString.h"
17 #include "SkPDFTypes.h" 17 #include "SkPDFTypes.h"
18 18
19 //static
20 SkPDFArray* SkPDFUtils::RectToArray(const SkRect& rect) {
21 SkPDFArray* result = new SkPDFArray();
22 result->reserve(4);
23 result->appendScalar(rect.fLeft);
24 result->appendScalar(rect.fTop);
25 result->appendScalar(rect.fRight);
26 result->appendScalar(rect.fBottom);
27 return result;
28 }
29
19 // static 30 // static
20 SkPDFArray* SkPDFUtils::MatrixToArray(const SkMatrix& matrix) { 31 SkPDFArray* SkPDFUtils::MatrixToArray(const SkMatrix& matrix) {
21 SkScalar values[6]; 32 SkScalar values[6];
22 if (!matrix.asAffine(values)) { 33 if (!matrix.asAffine(values)) {
23 SkMatrix::SetAffineIdentity(values); 34 SkMatrix::SetAffineIdentity(values);
24 } 35 }
25 36
26 SkPDFArray* result = new SkPDFArray; 37 SkPDFArray* result = new SkPDFArray;
27 result->reserve(6); 38 result->reserve(6);
28 for (size_t i = 0; i < SK_ARRAY_COUNT(values); i++) { 39 for (size_t i = 0; i < SK_ARRAY_COUNT(values); i++) {
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 content->writeDecAsText(objectIndex); 221 content->writeDecAsText(objectIndex);
211 content->writeText(" Do\n"); 222 content->writeText(" Do\n");
212 } 223 }
213 224
214 // static 225 // static
215 void SkPDFUtils::ApplyGraphicState(int objectIndex, SkWStream* content) { 226 void SkPDFUtils::ApplyGraphicState(int objectIndex, SkWStream* content) {
216 content->writeText("/G"); 227 content->writeText("/G");
217 content->writeDecAsText(objectIndex); 228 content->writeDecAsText(objectIndex);
218 content->writeText(" gs\n"); 229 content->writeText(" gs\n");
219 } 230 }
OLDNEW
« src/pdf/SkPDFShader.cpp ('K') | « src/pdf/SkPDFUtils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698