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

Side by Side Diff: Source/platform/graphics/ImageBuffer.cpp

Issue 895153002: Make CanvasRenderingContext2D use SkCanvas directly (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix issue with the copy composite operator Created 5 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
« no previous file with comments | « Source/platform/graphics/ImageBuffer.h ('k') | Source/platform/graphics/skia/SkiaUtils.h » ('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 (c) 2008, Google Inc. All rights reserved. 2 * Copyright (c) 2008, Google Inc. All rights reserved.
3 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 3 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are 7 * modification, are permitted provided that the following conditions are
8 * met: 8 * met:
9 * 9 *
10 * * Redistributions of source code must retain the above copyright 10 * * Redistributions of source code must retain the above copyright
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 m_surface->setImageBuffer(this); 88 m_surface->setImageBuffer(this);
89 } 89 }
90 90
91 ImageBuffer::~ImageBuffer() 91 ImageBuffer::~ImageBuffer()
92 { 92 {
93 } 93 }
94 94
95 GraphicsContext* ImageBuffer::context() const 95 GraphicsContext* ImageBuffer::context() const
96 { 96 {
97 if (!isSurfaceValid()) 97 if (!isSurfaceValid())
98 return 0; 98 return nullptr;
99 ASSERT(m_context.get()); 99 ASSERT(m_context.get());
100 return m_context.get(); 100 return m_context.get();
101 } 101 }
102 102
103 SkCanvas* ImageBuffer::canvas() const
104 {
105 if (!isSurfaceValid())
106 return nullptr;
107 return m_surface->canvas();
108 }
109
103 const SkBitmap& ImageBuffer::bitmap() const 110 const SkBitmap& ImageBuffer::bitmap() const
104 { 111 {
105 return m_surface->bitmap(); 112 return m_surface->bitmap();
106 } 113 }
107 114
108 bool ImageBuffer::isSurfaceValid() const 115 bool ImageBuffer::isSurfaceValid() const
109 { 116 {
110 return m_surface->isValid(); 117 return m_surface->isValid();
111 } 118 }
112 119
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); 407 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType));
401 408
402 Vector<char> encodedImage; 409 Vector<char> encodedImage;
403 if (!encodeImage(*this, mimeType, quality, &encodedImage)) 410 if (!encodeImage(*this, mimeType, quality, &encodedImage))
404 return "data:,"; 411 return "data:,";
405 412
406 return "data:" + mimeType + ";base64," + base64Encode(encodedImage); 413 return "data:" + mimeType + ";base64," + base64Encode(encodedImage);
407 } 414 }
408 415
409 } // namespace blink 416 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/graphics/ImageBuffer.h ('k') | Source/platform/graphics/skia/SkiaUtils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698