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

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

Issue 429643002: Add non-blocking frame rate limiting logic to display list 2D canvas (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: applied corrections Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « Source/platform/graphics/ImageBuffer.h ('k') | Source/platform/graphics/ImageBufferSurface.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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 } 90 }
91 91
92 ImageBuffer::~ImageBuffer() 92 ImageBuffer::~ImageBuffer()
93 { 93 {
94 } 94 }
95 95
96 GraphicsContext* ImageBuffer::context() const 96 GraphicsContext* ImageBuffer::context() const
97 { 97 {
98 if (!isSurfaceValid()) 98 if (!isSurfaceValid())
99 return 0; 99 return 0;
100 m_surface->willUse();
101 ASSERT(m_context.get()); 100 ASSERT(m_context.get());
102 return m_context.get(); 101 return m_context.get();
103 } 102 }
104 103
105 const SkBitmap& ImageBuffer::bitmap() const 104 const SkBitmap& ImageBuffer::bitmap() const
106 { 105 {
107 m_surface->willUse(); 106 m_surface->didDraw(); // conservative
108 return m_surface->bitmap(); 107 return m_surface->bitmap();
109 } 108 }
110 109
111 bool ImageBuffer::isSurfaceValid() const 110 bool ImageBuffer::isSurfaceValid() const
112 { 111 {
113 return m_surface->isValid(); 112 return m_surface->isValid();
114 } 113 }
115 114
116 bool ImageBuffer::restoreSurface() const 115 bool ImageBuffer::restoreSurface() const
117 { 116 {
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 if (!encodeImage(imageData, mimeType, quality, &encodedImage)) 421 if (!encodeImage(imageData, mimeType, quality, &encodedImage))
423 return "data:,"; 422 return "data:,";
424 423
425 Vector<char> base64Data; 424 Vector<char> base64Data;
426 base64Encode(encodedImage, base64Data); 425 base64Encode(encodedImage, base64Data);
427 426
428 return "data:" + mimeType + ";base64," + base64Data; 427 return "data:" + mimeType + ";base64," + base64Data;
429 } 428 }
430 429
431 } // namespace blink 430 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/graphics/ImageBuffer.h ('k') | Source/platform/graphics/ImageBufferSurface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698