OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |