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

Side by Side Diff: src/xps/SkXPSDevice.cpp

Issue 2333713002: change SkStreams to work with sk_sp<SkData> instead of SkData* (Closed)
Patch Set: fix xpsdevice Created 4 years, 3 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
« no previous file with comments | « src/ports/SkImageGeneratorWIC.cpp ('k') | tests/AnnotationTest.cpp » ('j') | 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 "SkTypes.h" 8 #include "SkTypes.h"
9 #if defined(SK_BUILD_FOR_WIN32) 9 #if defined(SK_BUILD_FOR_WIN32)
10 10
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 const SkMatrix& localMatrix, 655 const SkMatrix& localMatrix,
656 const SkShader::TileMode (&xy)[2], 656 const SkShader::TileMode (&xy)[2],
657 const SkAlpha alpha, 657 const SkAlpha alpha,
658 IXpsOMTileBrush** xpsBrush) { 658 IXpsOMTileBrush** xpsBrush) {
659 SkDynamicMemoryWStream write; 659 SkDynamicMemoryWStream write;
660 if (!SkImageEncoder::EncodeStream(&write, bitmap, 660 if (!SkImageEncoder::EncodeStream(&write, bitmap,
661 SkImageEncoder::kPNG_Type, 100)) { 661 SkImageEncoder::kPNG_Type, 100)) {
662 HRM(E_FAIL, "Unable to encode bitmap as png."); 662 HRM(E_FAIL, "Unable to encode bitmap as png.");
663 } 663 }
664 SkMemoryStream* read = new SkMemoryStream; 664 SkMemoryStream* read = new SkMemoryStream;
665 read->setData(write.copyToData())->unref(); 665 read->setData(write.detachAsData());
666 SkTScopedComPtr<IStream> readWrapper; 666 SkTScopedComPtr<IStream> readWrapper;
667 HRM(SkIStream::CreateFromSkStream(read, true, &readWrapper), 667 HRM(SkIStream::CreateFromSkStream(read, true, &readWrapper),
668 "Could not create stream from png data."); 668 "Could not create stream from png data.");
669 669
670 const size_t size = 670 const size_t size =
671 SK_ARRAY_COUNT(L"/Documents/1/Resources/Images/" L_GUID_ID L".png"); 671 SK_ARRAY_COUNT(L"/Documents/1/Resources/Images/" L_GUID_ID L".png");
672 wchar_t buffer[size]; 672 wchar_t buffer[size];
673 wchar_t id[GUID_ID_LEN]; 673 wchar_t id[GUID_ID_LEN];
674 HR(this->createId(id, GUID_ID_LEN)); 674 HR(this->createId(id, GUID_ID_LEN));
675 swprintf_s(buffer, size, L"/Documents/1/Resources/Images/%s.png", id); 675 swprintf_s(buffer, size, L"/Documents/1/Resources/Images/%s.png", id);
(...skipping 1601 matching lines...) Expand 10 before | Expand all | Expand 10 after
2277 //SkXPSDevice* dev = new SkXPSDevice(this); 2277 //SkXPSDevice* dev = new SkXPSDevice(this);
2278 //SkSize s = SkSize::Make(width, height); 2278 //SkSize s = SkSize::Make(width, height);
2279 //dev->BeginCanvas(s, s, SkMatrix::I()); 2279 //dev->BeginCanvas(s, s, SkMatrix::I());
2280 //return dev; 2280 //return dev;
2281 } 2281 }
2282 #endif 2282 #endif
2283 return new SkXPSDevice(this->fXpsFactory.get()); 2283 return new SkXPSDevice(this->fXpsFactory.get());
2284 } 2284 }
2285 2285
2286 #endif//defined(SK_BUILD_FOR_WIN32) 2286 #endif//defined(SK_BUILD_FOR_WIN32)
OLDNEW
« no previous file with comments | « src/ports/SkImageGeneratorWIC.cpp ('k') | tests/AnnotationTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698