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

Side by Side Diff: src/c/sk_surface.cpp

Issue 1817383002: switch surface to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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 | « samplecode/SampleTextureDomain.cpp ('k') | src/core/SkBitmapDevice.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 2014 Google Inc. 2 * Copyright 2014 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 "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkData.h" 9 #include "SkData.h"
10 #include "SkImage.h" 10 #include "SkImage.h"
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 SkImageInfo info; 426 SkImageInfo info;
427 if (!from_c_info(*cinfo, &info)) { 427 if (!from_c_info(*cinfo, &info)) {
428 return NULL; 428 return NULL;
429 } 429 }
430 SkPixelGeometry geo = kUnknown_SkPixelGeometry; 430 SkPixelGeometry geo = kUnknown_SkPixelGeometry;
431 if (props && !from_c_pixelgeometry(props->pixelGeometry, &geo)) { 431 if (props && !from_c_pixelgeometry(props->pixelGeometry, &geo)) {
432 return NULL; 432 return NULL;
433 } 433 }
434 434
435 SkSurfaceProps surfProps(0, geo); 435 SkSurfaceProps surfProps(0, geo);
436 return (sk_surface_t*)SkSurface::NewRaster(info, &surfProps); 436 return (sk_surface_t*)SkSurface::MakeRaster(info, &surfProps).release();
437 } 437 }
438 438
439 sk_surface_t* sk_surface_new_raster_direct(const sk_imageinfo_t* cinfo, void* pi xels, 439 sk_surface_t* sk_surface_new_raster_direct(const sk_imageinfo_t* cinfo, void* pi xels,
440 size_t rowBytes, 440 size_t rowBytes,
441 const sk_surfaceprops_t* props) { 441 const sk_surfaceprops_t* props) {
442 SkImageInfo info; 442 SkImageInfo info;
443 if (!from_c_info(*cinfo, &info)) { 443 if (!from_c_info(*cinfo, &info)) {
444 return NULL; 444 return NULL;
445 } 445 }
446 SkPixelGeometry geo = kUnknown_SkPixelGeometry; 446 SkPixelGeometry geo = kUnknown_SkPixelGeometry;
447 if (props && !from_c_pixelgeometry(props->pixelGeometry, &geo)) { 447 if (props && !from_c_pixelgeometry(props->pixelGeometry, &geo)) {
448 return NULL; 448 return NULL;
449 } 449 }
450 450
451 SkSurfaceProps surfProps(0, geo); 451 SkSurfaceProps surfProps(0, geo);
452 return (sk_surface_t*)SkSurface::NewRasterDirect(info, pixels, rowBytes, &su rfProps); 452 return (sk_surface_t*)SkSurface::MakeRasterDirect(info, pixels, rowBytes, &s urfProps).release();
453 } 453 }
454 454
455 void sk_surface_unref(sk_surface_t* csurf) { 455 void sk_surface_unref(sk_surface_t* csurf) {
456 SkSafeUnref((SkSurface*)csurf); 456 SkSafeUnref((SkSurface*)csurf);
457 } 457 }
458 458
459 sk_canvas_t* sk_surface_get_canvas(sk_surface_t* csurf) { 459 sk_canvas_t* sk_surface_get_canvas(sk_surface_t* csurf) {
460 SkSurface* surf = (SkSurface*)csurf; 460 SkSurface* surf = (SkSurface*)csurf;
461 return (sk_canvas_t*)surf->getCanvas(); 461 return (sk_canvas_t*)surf->getCanvas();
462 } 462 }
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 698
699 size_t sk_data_get_size(const sk_data_t* cdata) { 699 size_t sk_data_get_size(const sk_data_t* cdata) {
700 return AsData(cdata)->size(); 700 return AsData(cdata)->size();
701 } 701 }
702 702
703 const void* sk_data_get_data(const sk_data_t* cdata) { 703 const void* sk_data_get_data(const sk_data_t* cdata) {
704 return AsData(cdata)->data(); 704 return AsData(cdata)->data();
705 } 705 }
706 706
707 //////////////////////////////////////////////////////////////////////////////// /////////// 707 //////////////////////////////////////////////////////////////////////////////// ///////////
OLDNEW
« no previous file with comments | « samplecode/SampleTextureDomain.cpp ('k') | src/core/SkBitmapDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698