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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/DecodingImageGenerator.cpp

Issue 1484853003: Ganesh: images upload to GPU performance fix (skip copying encoded data) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Thread safe reference counting and disposal of shared data (m_data that is) Created 5 years 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 (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 , m_generationId(0) 44 , m_generationId(0)
45 { 45 {
46 } 46 }
47 47
48 DecodingImageGenerator::~DecodingImageGenerator() 48 DecodingImageGenerator::~DecodingImageGenerator()
49 { 49 {
50 } 50 }
51 51
52 SkData* DecodingImageGenerator::onRefEncodedData() 52 SkData* DecodingImageGenerator::onRefEncodedData()
53 { 53 {
54 // FIXME: If the image has been clipped or scaled, do not return the origina l 54 return m_frameGenerator->refSkData();
55 // encoded data, since on playback it will not be known how the clipping/sca ling
56 // was done.
57 RefPtr<SharedBuffer> buffer = nullptr;
58 bool allDataReceived = false;
59 m_frameGenerator->copyData(&buffer, &allDataReceived);
60 if (buffer && allDataReceived)
61 return SkData::NewWithCopy(buffer->data(), buffer->size());
62 return 0;
63 } 55 }
64 56
65 bool DecodingImageGenerator::onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, 57 bool DecodingImageGenerator::onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes,
66 SkPMColor ctable[], int* ctableCount) 58 SkPMColor ctable[], int* ctableCount)
67 { 59 {
68 TRACE_EVENT1("blink", "DecodingImageGenerator::getPixels", "index", static_c ast<int>(m_frameIndex)); 60 TRACE_EVENT1("blink", "DecodingImageGenerator::getPixels", "index", static_c ast<int>(m_frameIndex));
69 61
70 // Implementation doesn't support scaling yet so make sure we're not given a different size. 62 // Implementation doesn't support scaling yet so make sure we're not given a different size.
71 if (info.width() != getInfo().width() || info.height() != getInfo().height() ) 63 if (info.width() != getInfo().width() || info.height() != getInfo().height() )
72 return false; 64 return false;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 112
121 RefPtr<ImageFrameGenerator> frame = ImageFrameGenerator::create(SkISize::Mak e(size.width(), size.height()), buffer, true, false); 113 RefPtr<ImageFrameGenerator> frame = ImageFrameGenerator::create(SkISize::Mak e(size.width(), size.height()), buffer, true, false);
122 if (!frame) 114 if (!frame)
123 return 0; 115 return 0;
124 116
125 return new DecodingImageGenerator(frame, info, 0); 117 return new DecodingImageGenerator(frame, info, 0);
126 } 118 }
127 119
128 } // namespace blink 120 } // namespace blink
129 121
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698