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

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

Issue 24811002: Update the SkDocument interface to allow for 1) abort won't emit pdf, 2) close can report success/f… (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 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
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 "SkPDFShader.h" 10 #include "SkPDFShader.h"
11 11
12 #include "SkCanvas.h" 12 #include "SkCanvasSimplifier.h"
13 #include "SkData.h" 13 #include "SkData.h"
14 #include "SkPDFCatalog.h" 14 #include "SkPDFCatalog.h"
15 #include "SkPDFDevice.h" 15 #include "SkPDFDevice.h"
16 #include "SkPDFFormXObject.h" 16 #include "SkPDFFormXObject.h"
17 #include "SkPDFGraphicState.h" 17 #include "SkPDFGraphicState.h"
18 #include "SkPDFResourceDict.h" 18 #include "SkPDFResourceDict.h"
19 #include "SkPDFUtils.h" 19 #include "SkPDFUtils.h"
20 #include "SkScalar.h" 20 #include "SkScalar.h"
21 #include "SkStream.h" 21 #include "SkStream.h"
22 #include "SkTemplates.h" 22 #include "SkTemplates.h"
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 if (tileModes[0] != SkShader::kClamp_TileMode || 863 if (tileModes[0] != SkShader::kClamp_TileMode ||
864 tileModes[1] != SkShader::kClamp_TileMode) { 864 tileModes[1] != SkShader::kClamp_TileMode) {
865 deviceBounds.join(bitmapBounds); 865 deviceBounds.join(bitmapBounds);
866 } 866 }
867 867
868 SkMatrix unflip; 868 SkMatrix unflip;
869 unflip.setTranslate(0, SkScalarRoundToScalar(deviceBounds.height())); 869 unflip.setTranslate(0, SkScalarRoundToScalar(deviceBounds.height()));
870 unflip.preScale(SK_Scalar1, -SK_Scalar1); 870 unflip.preScale(SK_Scalar1, -SK_Scalar1);
871 SkISize size = SkISize::Make(SkScalarRound(deviceBounds.width()), 871 SkISize size = SkISize::Make(SkScalarRound(deviceBounds.width()),
872 SkScalarRound(deviceBounds.height())); 872 SkScalarRound(deviceBounds.height()));
873 // TODO(edisonn): should we pass here the DCT encoder of the destination dev ice?
vandebo (ex-Chrome) 2013/09/27 15:50:17 I would say so.
873 SkPDFDevice pattern(size, size, unflip); 874 SkPDFDevice pattern(size, size, unflip);
874 SkCanvas canvas(&pattern); 875 SkCanvasSimplifier canvas(&pattern);
vandebo (ex-Chrome) 2013/09/27 15:50:17 This doesn't help you here. I think this method w
edisonn 2013/10/04 19:40:37 Done.
vandebo (ex-Chrome) 2013/10/07 22:34:10 Done? how so?
edisonn 2013/10/08 17:55:30 Sorry, is being done in another CL, as it is not r
875 876
876 SkRect patternBBox; 877 SkRect patternBBox;
877 image->getBounds(&patternBBox); 878 image->getBounds(&patternBBox);
878 879
879 // Translate the canvas so that the bitmap origin is at (0, 0). 880 // Translate the canvas so that the bitmap origin is at (0, 0).
880 canvas.translate(-deviceBounds.left(), -deviceBounds.top()); 881 canvas.translate(-deviceBounds.left(), -deviceBounds.top());
881 patternBBox.offset(-deviceBounds.left(), -deviceBounds.top()); 882 patternBBox.offset(-deviceBounds.left(), -deviceBounds.top());
882 // Undo the translation in the final matrix 883 // Undo the translation in the final matrix
883 finalMatrix.preTranslate(deviceBounds.left(), deviceBounds.top()); 884 finalMatrix.preTranslate(deviceBounds.left(), deviceBounds.top());
884 885
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
1217 return false; 1218 return false;
1218 } 1219 }
1219 1220
1220 void SkPDFShader::State::AllocateGradientInfoStorage() { 1221 void SkPDFShader::State::AllocateGradientInfoStorage() {
1221 fColorData.set(sk_malloc_throw( 1222 fColorData.set(sk_malloc_throw(
1222 fInfo.fColorCount * (sizeof(SkColor) + sizeof(SkScalar)))); 1223 fInfo.fColorCount * (sizeof(SkColor) + sizeof(SkScalar))));
1223 fInfo.fColors = reinterpret_cast<SkColor*>(fColorData.get()); 1224 fInfo.fColors = reinterpret_cast<SkColor*>(fColorData.get());
1224 fInfo.fColorOffsets = 1225 fInfo.fColorOffsets =
1225 reinterpret_cast<SkScalar*>(fInfo.fColors + fInfo.fColorCount); 1226 reinterpret_cast<SkScalar*>(fInfo.fColors + fInfo.fColorCount);
1226 } 1227 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698