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: sky/engine/platform/graphics/DecodingImageGenerator.cpp

Issue 1235863004: Roll Skia to 2ced78866fcadd98895777c8dffe92e229775181 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 5 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 | « sky/engine/platform/graphics/DecodingImageGenerator.h ('k') | 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 (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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 // encoded data, since on playback it will not be known how the clipping/sca ling 51 // encoded data, since on playback it will not be known how the clipping/sca ling
52 // was done. 52 // was done.
53 RefPtr<SharedBuffer> buffer = nullptr; 53 RefPtr<SharedBuffer> buffer = nullptr;
54 bool allDataReceived = false; 54 bool allDataReceived = false;
55 m_frameGenerator->copyData(&buffer, &allDataReceived); 55 m_frameGenerator->copyData(&buffer, &allDataReceived);
56 if (buffer && allDataReceived) 56 if (buffer && allDataReceived)
57 return SkData::NewWithCopy(buffer->data(), buffer->size()); 57 return SkData::NewWithCopy(buffer->data(), buffer->size());
58 return 0; 58 return 0;
59 } 59 }
60 60
61 SkImageGenerator::Result DecodingImageGenerator::onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, const Options& options, SkPMColor ctable[], int* ctableCount) 61 bool DecodingImageGenerator::onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, SkPMColor ctable[], int* ctableCount)
62 { 62 {
63 TRACE_EVENT1("blink", "DecodingImageGenerator::getPixels", "index", static_c ast<int>(m_frameIndex)); 63 TRACE_EVENT1("blink", "DecodingImageGenerator::getPixels", "index", static_c ast<int>(m_frameIndex));
64 64
65 // Implementation doesn't support scaling yet so make sure we're not given a different size. 65 // Implementation doesn't support scaling yet so make sure we're not given a different size.
66 if (info.width() != info.width() || info.height() != info.height() || info.c olorType() != info.colorType()) { 66 if (info.width() != info.width() || info.height() != info.height() || info.c olorType() != info.colorType()) {
67 // ImageFrame may have changed the owning SkBitmap to kOpaque_SkAlphaTyp e after sniffing the encoded data, so if we see a request 67 // ImageFrame may have changed the owning SkBitmap to kOpaque_SkAlphaTyp e after sniffing the encoded data, so if we see a request
68 // for opaque, that is ok even if our initial alphatype was not opaque. 68 // for opaque, that is ok even if our initial alphatype was not opaque.
69 return Result::kInvalidScale; 69 return false;
70 } 70 }
71 71
72 bool decoded = m_frameGenerator->decodeAndScale(info, m_frameIndex, pixels, rowBytes); 72 return m_frameGenerator->decodeAndScale(info, m_frameIndex, pixels, rowBytes );
73 return decoded ? Result::kSuccess : Result::kInvalidInput;
74 } 73 }
75 74
76 bool DecodingImageGenerator::onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3]) 75 bool DecodingImageGenerator::onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3])
77 { 76 {
78 if (!planes || !planes[0]) { 77 if (!planes || !planes[0]) {
79 return m_frameGenerator->getYUVComponentSizes(sizes); 78 return m_frameGenerator->getYUVComponentSizes(sizes);
80 } 79 }
81 80
82 TRACE_EVENT0("blink", "DecodingImageGenerator::onGetYUV8Planes"); 81 TRACE_EVENT0("blink", "DecodingImageGenerator::onGetYUV8Planes");
83 bool decoded = m_frameGenerator->decodeToYUV(planes, rowBytes); 82 bool decoded = m_frameGenerator->decodeToYUV(planes, rowBytes);
84 return decoded; 83 return decoded;
85 } 84 }
86 85
87 } // namespace blink 86 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/platform/graphics/DecodingImageGenerator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698