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

Side by Side Diff: src/gpu/SkGr.cpp

Issue 1121813002: new image from backend desc (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: set samplecount to 0 (for now) Created 5 years, 7 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 | « src/gpu/SkGpuDevice.cpp ('k') | src/image/SkImage.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 2010 Google Inc. 2 * Copyright 2010 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 "SkGr.h" 8 #include "SkGr.h"
9 9
10 #include "GrXferProcessor.h" 10 #include "GrXferProcessor.h"
11 #include "SkColorFilter.h" 11 #include "SkColorFilter.h"
12 #include "SkConfig8888.h" 12 #include "SkConfig8888.h"
13 #include "SkData.h" 13 #include "SkData.h"
14 #include "SkErrorInternals.h" 14 #include "SkErrorInternals.h"
15 #include "SkGrPixelRef.h"
15 #include "SkMessageBus.h" 16 #include "SkMessageBus.h"
16 #include "SkPixelRef.h" 17 #include "SkPixelRef.h"
17 #include "SkResourceCache.h" 18 #include "SkResourceCache.h"
18 #include "SkTextureCompressor.h" 19 #include "SkTextureCompressor.h"
19 #include "SkYUVPlanesCache.h" 20 #include "SkYUVPlanesCache.h"
20 #include "effects/GrDitherEffect.h" 21 #include "effects/GrDitherEffect.h"
21 #include "effects/GrPorterDuffXferProcessor.h" 22 #include "effects/GrPorterDuffXferProcessor.h"
22 #include "effects/GrYUVtoRGBEffect.h" 23 #include "effects/GrYUVtoRGBEffect.h"
23 24
24 #ifndef SK_IGNORE_ETC1_SUPPORT 25 #ifndef SK_IGNORE_ETC1_SUPPORT
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 if (fp) { 731 if (fp) {
731 grPaint->addColorProcessor(fp)->unref(); 732 grPaint->addColorProcessor(fp)->unref();
732 constantColor = false; 733 constantColor = false;
733 } 734 }
734 } 735 }
735 736
736 // The grcolor is automatically set when calling asFragmentProcessor. 737 // The grcolor is automatically set when calling asFragmentProcessor.
737 // If the shader can be seen as an effect it returns true and adds its effec t to the grpaint. 738 // If the shader can be seen as an effect it returns true and adds its effec t to the grpaint.
738 return SkPaint2GrPaintNoShader(context, rt, skPaint, paintColor, constantCol or, grPaint); 739 return SkPaint2GrPaintNoShader(context, rt, skPaint, paintColor, constantCol or, grPaint);
739 } 740 }
741
742 SkImageInfo GrMakeInfoFromTexture(GrTexture* tex, int w, int h, bool isOpaque) {
743 #ifdef SK_DEBUG
744 const GrSurfaceDesc& desc = tex->desc();
745 SkASSERT(w <= desc.fWidth);
746 SkASSERT(h <= desc.fHeight);
747 #endif
748 const GrPixelConfig config = tex->config();
749 SkColorType ct;
750 SkAlphaType at = isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType;
751 if (!GrPixelConfig2ColorAndProfileType(config, &ct, NULL)) {
752 ct = kUnknown_SkColorType;
753 }
754 return SkImageInfo::Make(w, h, ct, at);
755 }
756
757
758 void GrWrapTextureInBitmap(GrTexture* src, int w, int h, bool isOpaque, SkBitmap * dst) {
759 const SkImageInfo info = GrMakeInfoFromTexture(src, w, h, isOpaque);
760 dst->setInfo(info);
761 dst->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, src)))->unref();
762 }
OLDNEW
« no previous file with comments | « src/gpu/SkGpuDevice.cpp ('k') | src/image/SkImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698