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

Side by Side Diff: src/core/SkPicture.cpp

Issue 1671193002: Make SkPicture/SkImageGenerator default to SkCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add references to bugs Created 4 years, 10 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
OLDNEW
1 /* 1 /*
2 * Copyright 2007 The Android Open Source Project 2 * Copyright 2007 The Android Open Source Project
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 "SkAtomics.h" 8 #include "SkAtomics.h"
9 #include "SkImageGenerator.h"
9 #include "SkMessageBus.h" 10 #include "SkMessageBus.h"
10 #include "SkPicture.h" 11 #include "SkPicture.h"
11 #include "SkPictureData.h" 12 #include "SkPictureData.h"
12 #include "SkPicturePlayback.h" 13 #include "SkPicturePlayback.h"
13 #include "SkPictureRecord.h" 14 #include "SkPictureRecord.h"
14 #include "SkPictureRecorder.h" 15 #include "SkPictureRecorder.h"
15 16
16 #if defined(SK_DISALLOW_CROSSPROCESS_PICTUREIMAGEFILTERS) || \ 17 #if defined(SK_DISALLOW_CROSSPROCESS_PICTUREIMAGEFILTERS) || \
17 defined(SK_ENABLE_PICTURE_IO_SECURITY_PRECAUTIONS) 18 defined(SK_ENABLE_PICTURE_IO_SECURITY_PRECAUTIONS)
18 static bool g_AllPictureIOSecurityPrecautionsEnabled = true; 19 static bool g_AllPictureIOSecurityPrecautionsEnabled = true;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 SkPicture* SkPicture::Forwardport(const SkPictInfo& info, const SkPictureData* d ata) { 132 SkPicture* SkPicture::Forwardport(const SkPictInfo& info, const SkPictureData* d ata) {
132 if (!data) { 133 if (!data) {
133 return nullptr; 134 return nullptr;
134 } 135 }
135 SkPicturePlayback playback(data); 136 SkPicturePlayback playback(data);
136 SkPictureRecorder r; 137 SkPictureRecorder r;
137 playback.draw(r.beginRecording(info.fCullRect), nullptr/*no callback*/); 138 playback.draw(r.beginRecording(info.fCullRect), nullptr/*no callback*/);
138 return r.endRecording(); 139 return r.endRecording();
139 } 140 }
140 141
142 bool SkPicture::DefaultInstall(const void* src, size_t length, SkBitmap* dst) {
143 SkAutoTUnref<SkData> encoded(SkData::NewWithCopy(src, length));
144 return encoded && SkDEPRECATED_InstallDiscardablePixelRef(
145 SkImageGenerator::NewFromEncoded(encoded), dst);
146 }
147
141 SkPicture* SkPicture::CreateFromStream(SkStream* stream, InstallPixelRefProc pro c) { 148 SkPicture* SkPicture::CreateFromStream(SkStream* stream, InstallPixelRefProc pro c) {
142 return CreateFromStream(stream, proc, nullptr); 149 return CreateFromStream(stream, proc, nullptr);
143 } 150 }
144 151
145 SkPicture* SkPicture::CreateFromStream(SkStream* stream, 152 SkPicture* SkPicture::CreateFromStream(SkStream* stream,
146 InstallPixelRefProc proc, 153 InstallPixelRefProc proc,
147 SkTypefacePlayback* typefaces) { 154 SkTypefacePlayback* typefaces) {
148 SkPictInfo info; 155 SkPictInfo info;
149 if (!InternalOnly_StreamIsSKP(stream, &info) || !stream->readBool()) { 156 if (!InternalOnly_StreamIsSKP(stream, &info) || !stream->readBool()) {
150 return nullptr; 157 return nullptr;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 } 223 }
217 224
218 // Global setting to disable security precautions for serialization. 225 // Global setting to disable security precautions for serialization.
219 void SkPicture::SetPictureIOSecurityPrecautionsEnabled_Dangerous(bool set) { 226 void SkPicture::SetPictureIOSecurityPrecautionsEnabled_Dangerous(bool set) {
220 g_AllPictureIOSecurityPrecautionsEnabled = set; 227 g_AllPictureIOSecurityPrecautionsEnabled = set;
221 } 228 }
222 229
223 bool SkPicture::PictureIOSecurityPrecautionsEnabled() { 230 bool SkPicture::PictureIOSecurityPrecautionsEnabled() {
224 return g_AllPictureIOSecurityPrecautionsEnabled; 231 return g_AllPictureIOSecurityPrecautionsEnabled;
225 } 232 }
OLDNEW
« include/core/SkPicture.h ('K') | « public.bzl ('k') | src/ports/SkImageGenerator_skia.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698