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

Side by Side Diff: src/utils/SkLua.cpp

Issue 575173002: Use SkImage::NewFromGenerator() instead of SkImage::newEncodedData() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 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 | « no previous file | no next file » | 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 2013 Google Inc. 2 * Copyright 2013 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 "SkLua.h" 8 #include "SkLua.h"
9 9
10 #if SK_SUPPORT_GPU 10 #if SK_SUPPORT_GPU
11 #include "GrReducedClip.h" 11 #include "GrReducedClip.h"
12 #endif 12 #endif
13 13
14 #include "SkCanvas.h" 14 #include "SkCanvas.h"
15 #include "SkData.h" 15 #include "SkData.h"
16 #include "SkDecodingImageGenerator.h"
16 #include "SkDocument.h" 17 #include "SkDocument.h"
17 #include "SkImage.h" 18 #include "SkImage.h"
18 #include "SkMatrix.h" 19 #include "SkMatrix.h"
19 #include "SkPaint.h" 20 #include "SkPaint.h"
20 #include "SkPath.h" 21 #include "SkPath.h"
21 #include "SkPixelRef.h" 22 #include "SkPixelRef.h"
22 #include "SkRRect.h" 23 #include "SkRRect.h"
23 #include "SkString.h" 24 #include "SkString.h"
24 #include "SkTextBlob.h" 25 #include "SkTextBlob.h"
25 #include "SkTypeface.h" 26 #include "SkTypeface.h"
(...skipping 1427 matching lines...) Expand 10 before | Expand all | Expand 10 after
1453 push_ref(L, face); 1454 push_ref(L, face);
1454 face->unref(); 1455 face->unref();
1455 return 1; 1456 return 1;
1456 } 1457 }
1457 1458
1458 static int lsk_loadImage(lua_State* L) { 1459 static int lsk_loadImage(lua_State* L) {
1459 if (lua_gettop(L) > 0 && lua_isstring(L, 1)) { 1460 if (lua_gettop(L) > 0 && lua_isstring(L, 1)) {
1460 const char* name = lua_tolstring(L, 1, NULL); 1461 const char* name = lua_tolstring(L, 1, NULL);
1461 SkAutoDataUnref data(SkData::NewFromFileName(name)); 1462 SkAutoDataUnref data(SkData::NewFromFileName(name));
1462 if (data.get()) { 1463 if (data.get()) {
1463 SkImage* image = SkImage::NewEncodedData(data.get()); 1464 SkImage* image = SkImage::NewFromGenerator(
1465 SkDecodingImageGenerator::Create(data, SkDecodingImageGenerator: :Options()));
reed1 2014/09/17 20:56:51 This Create can return null. Perhaps we should che
Rémi Piotaix 2014/09/17 21:06:55 I think it is checked in SkInstallDiscardablePixel
1466
1464 if (image) { 1467 if (image) {
1465 push_ref(L, image); 1468 push_ref(L, image);
1466 image->unref(); 1469 image->unref();
1467 return 1; 1470 return 1;
1468 } 1471 }
1469 } 1472 }
1470 } 1473 }
1471 return 0; 1474 return 0;
1472 } 1475 }
1473 1476
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1507 REG_CLASS(L, SkShader); 1510 REG_CLASS(L, SkShader);
1508 REG_CLASS(L, SkTypeface); 1511 REG_CLASS(L, SkTypeface);
1509 REG_CLASS(L, SkMatrix); 1512 REG_CLASS(L, SkMatrix);
1510 } 1513 }
1511 1514
1512 extern "C" int luaopen_skia(lua_State* L); 1515 extern "C" int luaopen_skia(lua_State* L);
1513 extern "C" int luaopen_skia(lua_State* L) { 1516 extern "C" int luaopen_skia(lua_State* L) {
1514 SkLua::Load(L); 1517 SkLua::Load(L);
1515 return 0; 1518 return 0;
1516 } 1519 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698