aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/opts/SkTextureCompression_opts_arm.cpp
blob: 36ff15c1d11157cfcf69e7d548c008225f068367 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
 * Copyright 2014 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include "SkTextureCompression_opts.h"
#include "SkTextureCompression_opts_neon.h"
#include "SkUtilsArm.h"

SkTextureCompressor::CompressionProc
SkTextureCompressorGetPlatformProc(SkColorType colorType, SkTextureCompressor::Format fmt) {
#if SK_ARM_NEON_IS_NONE
    return NULL;
#else
#if SK_ARM_NEON_IS_DYNAMIC
    if (!sk_cpu_arm_has_neon()) {
        return NULL;
    }
#endif
    switch (colorType) {
        case kAlpha_8_SkColorType:
        {
            switch (fmt) {
                case SkTextureCompressor::kR11_EAC_Format:
                    return CompressA8toR11EAC_NEON;
                default:
                    return NULL;
            }
        }
        break;

        default:
            return NULL;
    }
#endif
}

bool SkTextureCompressorGetPlatformDims(SkTextureCompressor::Format fmt, int* dimX, int* dimY) {
#if SK_ARM_NEON_IS_NONE
    return false;
#else
#if SK_ARM_NEON_IS_DYNAMIC
    if (!sk_cpu_arm_has_neon()) {
        return false;
    }
#endif
    switch (fmt) {
        case SkTextureCompressor::kR11_EAC_Format:
            *dimX = 16;
            *dimY = 4;
            return true;
        default:
            return false;
    }
    return false;
#endif
}