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

Side by Side Diff: tools/debugger/SkDrawCommand.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 | « tests/TypefaceTest.cpp ('k') | tools/fiddle/fiddle_main.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 2012 Google Inc. 2 * Copyright 2012 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 "SkDrawCommand.h" 8 #include "SkDrawCommand.h"
9 9
10 #include "SkBlurMaskFilter.h" 10 #include "SkBlurMaskFilter.h"
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 return false; 700 return false;
701 } 701 }
702 702
703 SkBitmap bm; 703 SkBitmap bm;
704 bm.installPixels(dstInfo, buffer.get(), rowBytes); 704 bm.installPixels(dstInfo, buffer.get(), rowBytes);
705 sk_sp<SkData> encodedBitmap = sk_tools::encode_bitmap_for_png(bm); 705 sk_sp<SkData> encodedBitmap = sk_tools::encode_bitmap_for_png(bm);
706 706
707 SkDynamicMemoryWStream out; 707 SkDynamicMemoryWStream out;
708 SkDrawCommand::WritePNG((const png_bytep) encodedBitmap->bytes(), image.widt h(), image.height(), 708 SkDrawCommand::WritePNG((const png_bytep) encodedBitmap->bytes(), image.widt h(), image.height(),
709 out, false); 709 out, false);
710 SkData* encoded = out.copyToData(); 710 sk_sp<SkData> encoded = out.detachAsData();
711 Json::Value jsonData; 711 Json::Value jsonData;
712 encode_data(encoded->data(), encoded->size(), "image/png", urlDataManager, & jsonData); 712 encode_data(encoded->data(), encoded->size(), "image/png", urlDataManager, & jsonData);
713 (*target)[SKDEBUGCANVAS_ATTRIBUTE_DATA] = jsonData; 713 (*target)[SKDEBUGCANVAS_ATTRIBUTE_DATA] = jsonData;
714 encoded->unref();
715 return true; 714 return true;
716 } 715 }
717 716
718 static const char* color_type_name(SkColorType colorType) { 717 static const char* color_type_name(SkColorType colorType) {
719 switch (colorType) { 718 switch (colorType) {
720 case kARGB_4444_SkColorType: 719 case kARGB_4444_SkColorType:
721 return SKDEBUGCANVAS_COLORTYPE_ARGB4444; 720 return SKDEBUGCANVAS_COLORTYPE_ARGB4444;
722 case kRGBA_8888_SkColorType: 721 case kRGBA_8888_SkColorType:
723 return SKDEBUGCANVAS_COLORTYPE_RGBA8888; 722 return SKDEBUGCANVAS_COLORTYPE_RGBA8888;
724 case kBGRA_8888_SkColorType: 723 case kBGRA_8888_SkColorType:
(...skipping 2823 matching lines...) Expand 10 before | Expand all | Expand 10 after
3548 SkTranslateZCommand* SkTranslateZCommand::fromJSON(Json::Value& command, 3547 SkTranslateZCommand* SkTranslateZCommand::fromJSON(Json::Value& command,
3549 UrlDataManager& urlDataManager) { 3548 UrlDataManager& urlDataManager) {
3550 SkScalar z; 3549 SkScalar z;
3551 #ifdef SK_EXPERIMENTAL_SHADOWING 3550 #ifdef SK_EXPERIMENTAL_SHADOWING
3552 extract_json_scalar(command[SKDEBUGCANVAS_ATTRIBUTE_DRAWDEPTHTRANS], &z); 3551 extract_json_scalar(command[SKDEBUGCANVAS_ATTRIBUTE_DRAWDEPTHTRANS], &z);
3553 #else 3552 #else
3554 z = 0; 3553 z = 0;
3555 #endif 3554 #endif
3556 return new SkTranslateZCommand(z); 3555 return new SkTranslateZCommand(z);
3557 } 3556 }
OLDNEW
« no previous file with comments | « tests/TypefaceTest.cpp ('k') | tools/fiddle/fiddle_main.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698